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 Scene or Scene. Scene is a 2D element that embeds the 3D scene, and a 2D Scene 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 Scene 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 scene, with LayoutHoriz's within that, or a LayoutGrid for more complex layouts:
win := gi.NewMainRenderWin("test-window", "Test RenderWin", width, height) vp := win.WinScene() updt := vp.UpdateStart() vlay := win.SetMainVLay() // or SetMainFrame row1 := gi.NewLayout(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 Value framework allows for easy customization and extension of the GUI representation, based on the classic Go "Stringer"-like interface paradigm -- simply define a Value() method on any type, returning giv.Value that manages the interface between data structures and GUI representations.
See 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.RenderWin 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.TextEditor cursors), Drag-n-Drop, etc.
Index ¶
- Constants
- Variables
- func ActivateExistingDialogWindow(data any) bool
- func ActivateExistingMainWindow(data any) bool
- func AddToSpellModel(filepath string) error
- func AsWidget(k ki.Ki) (Widget, *WidgetBase)
- func ChildByLabelStartsCanFocus(ly *Layout, name string, after ki.Ki) (ki.Ki, bool)
- func CompleteEditText(text string, cp int, completion string, seed string) (ed complete.Edit)
- func CompleteText(s string) []string
- func CurrentWindowAppBar(tb *Toolbar)
- func DataDir() string
- func EndCPUMemProfile()
- func EndTargProfile()
- func ErrorDialog(ctx Widget, err error, title ...string)
- func ErrorSnackbar(ctx Widget, err error, label ...string)
- func GokiDataDir() string
- func GrabRenderFrom(wi Widget) *image.RGBA
- func ImageClearer(im *image.RGBA, pct float32)
- func ImageToRGBA(img image.Image) *image.RGBA
- func Init()
- func InitSpell() error
- func LinearTransition(prop float32) float32
- func MenuSceneConfigStyles(msc *Scene)
- func MessageDialog(ctx Widget, msg string, title ...string)
- func MessageSnackbar(ctx Widget, msg string)
- func NewSpellModelFromText() error
- func OpenPNG(path string) (image.Image, error)
- func OpenPaths()
- func OpenSpellModel() error
- func OpenURL(url string)
- func ProfileToggle()
- func ProgressDefaultInc(max int) int
- func Quit()
- func QuitReq()
- func RecycleDialog(data any) bool
- func RunTest(test func())
- func SavePNG(path string, im image.Image) error
- func SavePaths()
- func SaveSpellModel() error
- func SetQuitCleanFunc(fun func())
- func SetQuitReqFunc(fun func())
- func SetUnitContext(st *styles.Style, sc *Scene, el, par mat32.Vec2)
- func StackAll() []byte
- func StartCPUMemProfile()
- func StartTargProfile()
- func StdAppBarConfig(pw Widget)
- func StdAppBarStart(tb *Toolbar)
- func StdOverflowMenu(tb *Toolbar)
- 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 TextFieldBlink()
- func ToLabel(it any) string
- func ToLabeler(it any) (string, bool)
- func ToolbarStyles(ly Layouter)
- func Wait()
- func WinNewCloseStamp()
- type App
- type AppChooser
- func (ac *AppChooser) CopyFieldsFrom(frm any)
- func (t *AppChooser) KiType() *gti.Type
- func (t *AppChooser) New() ki.Ki
- func (ac *AppChooser) OnAdd()
- func (ac *AppChooser) OnInit()
- func (t *AppChooser) SetAllowNew(v bool) *AppChooser
- func (t *AppChooser) SetClass(v string) *AppChooser
- func (t *AppChooser) SetCustomContextMenu(v func(m *Scene)) *AppChooser
- func (t *AppChooser) SetEditable(v bool) *AppChooser
- func (t *AppChooser) SetIcon(v icons.Icon) *AppChooser
- func (t *AppChooser) SetIcons(v []icons.Icon) *AppChooser
- func (t *AppChooser) SetIndicator(v icons.Icon) *AppChooser
- func (t *AppChooser) SetItems(v []any) *AppChooser
- func (t *AppChooser) SetItemsFunc(v func()) *AppChooser
- func (t *AppChooser) SetMaxLength(v int) *AppChooser
- func (t *AppChooser) SetResources(v uri.Resources) *AppChooser
- func (t *AppChooser) SetTooltip(v string) *AppChooser
- func (t *AppChooser) SetTooltips(v []string) *AppChooser
- func (t *AppChooser) SetType(v ChooserTypes) *AppChooser
- type BarFuncs
- type BasicBar
- func (t *BasicBar) KiType() *gti.Type
- func (t *BasicBar) New() ki.Ki
- func (tb *BasicBar) OnInit()
- func (t *BasicBar) SetClass(v string) *BasicBar
- func (t *BasicBar) SetCustomContextMenu(v func(m *Scene)) *BasicBar
- func (t *BasicBar) SetStackTop(v int) *BasicBar
- func (t *BasicBar) SetStripes(v Stripes) *BasicBar
- func (t *BasicBar) SetTooltip(v string) *BasicBar
- func (tb *BasicBar) UpdateBar()
- type Body
- func (bd *Body) AddAppBar(fun func(tb *Toolbar))
- func (bd *Body) AddBottomBar(fun func(pw Widget))
- func (bd *Body) AddCancel(pw Widget, name ...string) *Button
- func (bd *Body) AddLeftBar(fun func(pw Widget))
- func (bd *Body) AddOk(pw Widget, name ...string) *Button
- func (bd *Body) AddOkOnly() *Body
- func (bd *Body) AddRightBar(fun func(pw Widget))
- func (bd *Body) AddText(text string) *Body
- func (bd *Body) AddTitle(title string) *Body
- func (bd *Body) AddTopBar(fun func(pw Widget))
- func (bd *Body) Close()
- func (bd *Body) GetTopAppBar() *Toolbar
- func (t *Body) KiType() *gti.Type
- func (t *Body) New() ki.Ki
- func (bd *Body) NewDialog(ctx Widget, name ...string) *Stage
- func (bd *Body) NewFullDialog(ctx Widget, name ...string) *Stage
- func (bd *Body) NewWindow() *Stage
- func (bd *Body) OnInit()
- func (bd *Body) SetApp(app *App) *Body
- func (t *Body) SetClass(v string) *Body
- func (t *Body) SetCustomContextMenu(v func(m *Scene)) *Body
- func (t *Body) SetStackTop(v int) *Body
- func (t *Body) SetStripes(v Stripes) *Body
- func (bd *Body) SetStyles()
- func (t *Body) SetTitle(v string) *Body
- func (t *Body) SetTooltip(v string) *Body
- type Box
- type Button
- func (t *Button) AsButton() *Button
- func (bt *Button) ConfigParts()
- func (bt *Button) ConfigPartsAddIndicator(config *ki.Config, defOn bool) int
- func (bt *Button) ConfigPartsAddShortcut(config *ki.Config) int
- func (bt *Button) ConfigPartsIconLabel(config *ki.Config, icnm icons.Icon, txt string) (icIdx, lbIdx int)
- func (bt *Button) ConfigPartsIndicator(indIdx int)
- func (bt *Button) ConfigPartsSetIconLabel(icnm icons.Icon, txt string, icIdx, lbIdx int)
- func (bt *Button) ConfigPartsShortcut(scIdx int)
- func (bt *Button) ConfigWidget()
- func (bt *Button) CopyFieldsFrom(frm any)
- func (bt *Button) HandleClickDismissMenu()
- func (bt *Button) HandleClickMenu()
- func (bt *Button) HandleEvents()
- func (bt *Button) HandleLongHoverTooltip()
- func (bt *Button) HasMenu() bool
- func (bt *Button) IconWidget() *Icon
- func (t *Button) KiType() *gti.Type
- func (bt *Button) Label() string
- func (bt *Button) LabelWidget() *Label
- func (t *Button) New() ki.Ki
- func (bt *Button) OnInit()
- func (bt *Button) OpenMenu(e events.Event) bool
- func (bt *Button) Render()
- func (bt *Button) RenderButton()
- func (t *Button) SetClass(v string) *Button
- func (t *Button) SetCustomContextMenu(v func(m *Scene)) *Button
- func (t *Button) SetData(v any) *Button
- func (t *Button) SetIcon(v icons.Icon) *Button
- func (bt *Button) SetIconUpdate(icon icons.Icon) *Button
- func (t *Button) SetIndicator(v icons.Icon) *Button
- func (bt *Button) SetKey(kf keyfun.Funs) *Button
- func (t *Button) SetMenu(v func(m *Scene)) *Button
- func (t *Button) SetShortcut(v key.Chord) *Button
- func (bt *Button) SetStyles()
- func (bt *Button) SetText(v string) *Button
- func (bt *Button) SetTextUpdate(text string) *Button
- func (t *Button) SetTooltip(v string) *Button
- func (t *Button) SetType(v ButtonTypes) *Button
- func (bt *Button) ShortcutTooltip() string
- func (bt *Button) ShowContextMenu(e events.Event)
- type ButtonEmbedder
- type ButtonTypes
- func (i ButtonTypes) Desc() string
- func (i ButtonTypes) Int64() int64
- func (i ButtonTypes) IsValid() bool
- func (i ButtonTypes) MarshalText() ([]byte, error)
- func (i *ButtonTypes) SetInt64(in int64)
- func (i *ButtonTypes) SetString(s string) error
- func (i ButtonTypes) String() string
- func (i *ButtonTypes) UnmarshalText(text []byte) error
- func (i ButtonTypes) Values() []enums.Enum
- type Chooser
- func (ch *Chooser) CompleteEdit(data any, text string, cursorPos int, completion complete.Completion, ...) (ed complete.Edit)
- func (ch *Chooser) CompleteMatch(data any, text string, posLn, posCh int) (md complete.Matches)
- func (ch *Chooser) ConfigParts()
- func (ch *Chooser) ConfigWidget()
- func (ch *Chooser) CopyFieldsFrom(frm any)
- func (ch *Chooser) FindItem(it any) int
- func (ch *Chooser) GetCurTextAction() any
- func (ch *Chooser) HandleChooserTextFieldEvents(tf *TextField)
- func (ch *Chooser) HandleEvents()
- func (ch *Chooser) HandleKeys()
- func (ch *Chooser) IconWidget() *Icon
- func (t *Chooser) KiType() *gti.Type
- func (ch *Chooser) LabelWidget() *Label
- func (ch *Chooser) MakeItems(reset bool, capacity int)
- func (ch *Chooser) MakeItemsMenu(m *Scene)
- func (t *Chooser) New() ki.Ki
- func (ch *Chooser) OnInit()
- func (ch *Chooser) OpenMenu(e events.Event) bool
- func (ch *Chooser) Render()
- func (ch *Chooser) RenderChooser()
- func (ch *Chooser) SelectItem(idx int) *Chooser
- func (ch *Chooser) SelectItemAction(idx int)
- func (t *Chooser) SetAllowNew(v bool) *Chooser
- func (t *Chooser) SetClass(v string) *Chooser
- func (ch *Chooser) SetCurIndex(idx int) any
- func (ch *Chooser) SetCurText(text string) any
- func (ch *Chooser) SetCurTextAction(text string) any
- func (ch *Chooser) SetCurVal(it any) int
- func (t *Chooser) SetCustomContextMenu(v func(m *Scene)) *Chooser
- func (t *Chooser) SetEditable(v bool) *Chooser
- func (ch *Chooser) SetEnum(enum enums.Enum, setFirst bool, maxLen int) *Chooser
- func (ch *Chooser) SetEnums(el []enums.Enum, setFirst bool, maxLen int) *Chooser
- func (t *Chooser) SetIcon(v icons.Icon) *Chooser
- func (ch *Chooser) SetIconItems(el []icons.Icon, setFirst bool, maxLen int) *Chooser
- func (ch *Chooser) SetIconUpdate(ic icons.Icon) *Chooser
- func (t *Chooser) SetIcons(v []icons.Icon) *Chooser
- func (t *Chooser) SetIndicator(v icons.Icon) *Chooser
- func (t *Chooser) SetItems(v []any) *Chooser
- func (t *Chooser) SetItemsFunc(v func()) *Chooser
- func (t *Chooser) SetMaxLength(v int) *Chooser
- func (ch *Chooser) SetPlaceholder(text string) *Chooser
- func (ch *Chooser) SetStrings(el []string, setFirst bool, maxLen int) *Chooser
- func (ch *Chooser) SetStyles()
- func (ch *Chooser) SetToMaxLength(maxLen int)
- func (t *Chooser) SetTooltip(v string) *Chooser
- func (t *Chooser) SetTooltips(v []string) *Chooser
- func (t *Chooser) SetType(v ChooserTypes) *Chooser
- func (ch *Chooser) SetTypes(tl []*gti.Type, setFirst, sort bool, maxLen int) *Chooser
- func (ch *Chooser) ShowCurVal(label string)
- func (ch *Chooser) SortItems(ascending bool)
- func (ch *Chooser) TextField() (*TextField, bool)
- type ChooserTypes
- func (i ChooserTypes) Desc() string
- func (i ChooserTypes) Int64() int64
- func (i ChooserTypes) IsValid() bool
- func (i ChooserTypes) MarshalText() ([]byte, error)
- func (i *ChooserTypes) SetInt64(in int64)
- func (i *ChooserTypes) SetString(s string) error
- func (i ChooserTypes) String() string
- func (i *ChooserTypes) UnmarshalText(text []byte) error
- func (i ChooserTypes) Values() []enums.Enum
- type Complete
- func (c *Complete) Abort() bool
- func (c *Complete) Cancel() bool
- func (c *Complete) Complete(s string)
- func (c *Complete) GetCompletion(s string) complete.Completion
- func (c *Complete) IsAboutToShow() bool
- func (c *Complete) Lookup(text string, posLn, posCh int, sc *Scene, pt image.Point, force bool)
- func (c *Complete) On(etype events.Types, fun func(e events.Event))
- func (c *Complete) OnSelect(fun func(e events.Event))
- func (t *Complete) SetCompletion(v string) *Complete
- func (t *Complete) SetCompletions(v complete.Completions) *Complete
- func (t *Complete) SetContext(v any) *Complete
- func (t *Complete) SetEditFunc(v complete.EditFunc) *Complete
- func (t *Complete) SetLookupFunc(v complete.LookupFunc) *Complete
- func (t *Complete) SetMatchFunc(v complete.MatchFunc) *Complete
- func (t *Complete) SetSeed(v string) *Complete
- func (t *Complete) SetSrcCh(v int) *Complete
- func (t *Complete) SetSrcLn(v int) *Complete
- func (t *Complete) SetStage(v *Stage) *Complete
- func (c *Complete) Show(ctx Widget, pos image.Point, text string, force bool)
- func (c *Complete) ShowNow(ctx Widget, pos image.Point, text string, force bool)
- type CompleteSignals
- func (i CompleteSignals) Desc() string
- func (i CompleteSignals) Int64() int64
- func (i CompleteSignals) IsValid() bool
- func (i CompleteSignals) MarshalText() ([]byte, error)
- func (i *CompleteSignals) SetInt64(in int64)
- func (i *CompleteSignals) SetString(s string) error
- func (i CompleteSignals) String() string
- func (i *CompleteSignals) UnmarshalText(text []byte) error
- func (i CompleteSignals) Values() []enums.Enum
- type Completer
- type Densities
- func (i Densities) Desc() string
- func (i Densities) Int64() int64
- func (i Densities) IsValid() bool
- func (i Densities) MarshalText() ([]byte, error)
- func (i *Densities) SetInt64(in int64)
- func (i *Densities) SetString(s string) error
- func (i Densities) String() string
- func (i *Densities) UnmarshalText(text []byte) error
- func (i Densities) Values() []enums.Enum
- type EditorPrefs
- type EventMgr
- func (em *EventMgr) ActivateStartFocus() bool
- func (em *EventMgr) AddShortcut(chord key.Chord, bt *Button)
- func (em *EventMgr) ClearNonFocus(foc Widget)
- func (em *EventMgr) ClipBoard() clip.Board
- func (em *EventMgr) DeleteShortcut(chord key.Chord, bt *Button)
- func (em *EventMgr) DragClearSprite()
- func (em *EventMgr) DragDrop(drag Widget, e events.Event)
- func (em *EventMgr) DragMenuAddModLabel(m *Scene, mod events.DropMods)
- func (em *EventMgr) DragMove(e events.Event)
- func (em *EventMgr) DragStart(w Widget, data any, e events.Event)
- func (em *EventMgr) DragStartCheck(e events.Event, dur time.Duration, dist int) bool
- func (em *EventMgr) DropFinalize(de *events.DragDrop)
- func (em *EventMgr) FocusClear() bool
- func (em *EventMgr) FocusFirst() bool
- func (em *EventMgr) FocusLast() bool
- func (em *EventMgr) FocusLastFrom(from Widget) bool
- func (em *EventMgr) FocusNext() bool
- func (em *EventMgr) FocusNextFrom(from Widget) bool
- func (em *EventMgr) FocusOnOrNext(foc Widget) bool
- func (em *EventMgr) FocusOnOrPrev(foc Widget) bool
- func (em *EventMgr) FocusPrev() bool
- func (em *EventMgr) FocusPrevFrom(from Widget) bool
- func (em *EventMgr) FocusWithins() bool
- func (em *EventMgr) GetMouseInBBox(w Widget, pos image.Point)
- func (em *EventMgr) GetPriorityWidgets()
- func (em *EventMgr) HandleEvent(e events.Event)
- func (em *EventMgr) HandleFocusEvent(e events.Event)
- func (em *EventMgr) HandleLong(e events.Event, deep Widget, w *Widget, pos *image.Point, t **time.Timer, ...)
- func (em *EventMgr) HandleLongHover(e events.Event)
- func (em *EventMgr) HandleLongPress(e events.Event)
- func (em *EventMgr) HandleOtherEvent(e events.Event)
- func (em *EventMgr) HandlePosEvent(e events.Event)
- func (em *EventMgr) MainStageMgr() *StageMgr
- func (em *EventMgr) ManagerKeyChordEvents(e events.Event)
- func (em *EventMgr) RenderWin() *RenderWin
- func (em *EventMgr) ResetOnMouseDown()
- func (em *EventMgr) SetCursor(cur cursors.Cursor)
- func (em *EventMgr) SetFocus(w Widget) bool
- func (em *EventMgr) SetFocusEvent(w Widget) bool
- func (em *EventMgr) SetFocusImpl(w Widget, sendEvent bool) bool
- func (em *EventMgr) SetStartFocus(k Widget)
- func (em *EventMgr) TopLongHover() Widget
- func (em *EventMgr) TriggerShortcut(chord key.Chord) bool
- func (em *EventMgr) UpdateHovers(hov, prev []Widget, e events.Event, enter, leave events.Types) []Widget
- type FavPathItem
- type FavPaths
- type FileName
- type FilePaths
- type FontName
- type Frame
- func (fr *Frame) CopyFieldsFrom(frm any)
- func (fr *Frame) FrameStdRender()
- func (t *Frame) KiType() *gti.Type
- func (t *Frame) New() ki.Ki
- func (fr *Frame) OnInit()
- func (fr *Frame) Render()
- func (fr *Frame) RenderStripes()
- func (t *Frame) SetClass(v string) *Frame
- func (t *Frame) SetCustomContextMenu(v func(m *Scene)) *Frame
- func (t *Frame) SetStackTop(v int) *Frame
- func (t *Frame) SetStripes(v Stripes) *Frame
- func (fr *Frame) SetStyles()
- func (t *Frame) SetTooltip(v string) *Frame
- type GeneralSettingsData
- func (pf *GeneralSettingsData) Apply()
- func (pf *GeneralSettingsData) ApplyDPI()
- func (pf *GeneralSettingsData) DarkMode()
- func (pf *GeneralSettingsData) Defaults()
- func (pf *GeneralSettingsData) Delete() error
- func (pf *GeneralSettingsData) DeleteSavedWindowGeoms()
- func (pf *GeneralSettingsData) DensityType() Densities
- func (pf *GeneralSettingsData) EditDebug()
- func (pf *GeneralSettingsData) EditDetailed()
- func (pf *GeneralSettingsData) EditHiStyles()
- func (pf *GeneralSettingsData) EditKeyMaps()
- func (pf *GeneralSettingsData) LightMode()
- func (pf *GeneralSettingsData) Open() error
- func (pf *GeneralSettingsData) PrefFontFamily() string
- func (pf *GeneralSettingsData) Save() error
- func (pf *GeneralSettingsData) SaveZoom(forCurrentScreen bool)
- func (pf *GeneralSettingsData) ScreenInfo() []*goosi.Screen
- func (pf *GeneralSettingsData) TimeFormat() string
- func (pf *GeneralSettingsData) UpdateAll()
- func (pf *GeneralSettingsData) UpdateUser()
- func (pf *GeneralSettingsData) VersionInfo() string
- type GeomCT
- type GeomSize
- type GeomState
- type Handle
- func (hl *Handle) HandleEvents()
- func (t *Handle) KiType() *gti.Type
- func (t *Handle) New() ki.Ki
- func (hl *Handle) OnInit()
- func (t *Handle) SetClass(v string) *Handle
- func (t *Handle) SetCustomContextMenu(v func(m *Scene)) *Handle
- func (t *Handle) SetDim(v mat32.Dims) *Handle
- func (t *Handle) SetMax(v float32) *Handle
- func (t *Handle) SetMin(v float32) *Handle
- func (t *Handle) SetPos(v float32) *Handle
- func (hl *Handle) SetStyles()
- func (t *Handle) SetTooltip(v string) *Handle
- func (hl *Handle) Value() float32
- type HiStyleName
- type Icon
- func (ic *Icon) CopyFieldsFrom(frm any)
- func (ic *Icon) DrawIntoScene()
- func (t *Icon) KiType() *gti.Type
- func (t *Icon) New() ki.Ki
- func (ic *Icon) OnInit()
- func (ic *Icon) Render()
- func (ic *Icon) RenderSVG()
- func (t *Icon) SetClass(v string) *Icon
- func (t *Icon) SetCustomContextMenu(v func(m *Scene)) *Icon
- func (ic *Icon) SetIcon(icon icons.Icon) *Icon
- func (ic *Icon) SetIconTry(icon icons.Icon) (bool, error)
- func (ic *Icon) SetIconUpdate(icon icons.Icon) *Icon
- func (ic *Icon) SetStyles()
- func (t *Icon) SetTooltip(v string) *Icon
- type Image
- func (im *Image) ConfigToolbar(tb *Toolbar)
- func (im *Image) CopyFieldsFrom(frm any)
- func (im *Image) DrawIntoScene()
- func (im *Image) GrabRenderFrom(wi Widget)
- func (t *Image) KiType() *gti.Type
- func (t *Image) New() ki.Ki
- func (im *Image) OnInit()
- func (im *Image) OpenImage(filename FileName) error
- func (im *Image) OpenImageFS(fsys fs.FS, filename FileName) error
- func (im *Image) Render()
- func (t *Image) SetClass(v string) *Image
- func (t *Image) SetCustomContextMenu(v func(m *Scene)) *Image
- func (im *Image) SetImage(img image.Image)
- func (im *Image) SetSize(sz image.Point)
- func (im *Image) SetStyles()
- func (t *Image) SetTooltip(v string) *Image
- type Label
- func (t *Label) AsLabel() *Label
- func (lb *Label) ConfigLabel()
- func (lb *Label) ConfigLabelAlloc(sz mat32.Vec2) mat32.Vec2
- func (lb *Label) ConfigLabelSize(sz mat32.Vec2)
- func (lb *Label) ConfigWidget()
- func (lb *Label) Copy(reset bool)
- func (lb *Label) CopyFieldsFrom(frm any)
- func (lb *Label) HandleEvents()
- func (lb *Label) HandleLabelClick(openLink func(tl *paint.TextLink))
- func (t *Label) KiType() *gti.Type
- func (t *Label) New() ki.Ki
- func (lb *Label) OnInit()
- func (lb *Label) Render()
- func (lb *Label) RenderLabel()
- func (t *Label) SetClass(v string) *Label
- func (t *Label) SetCustomContextMenu(v func(m *Scene)) *Label
- func (lb *Label) SetStyles()
- func (t *Label) SetText(v string) *Label
- func (lb *Label) SetTextUpdate(text string) *Label
- func (t *Label) SetTooltip(v string) *Label
- func (t *Label) SetType(v LabelTypes) *Label
- func (lb *Label) SizeDown(iter int) bool
- func (lb *Label) SizeUp()
- func (lb *Label) SizeUpWrapSize() mat32.Vec2
- type LabelEmbedder
- type LabelTypes
- func (i LabelTypes) Desc() string
- func (i LabelTypes) Int64() int64
- func (i LabelTypes) IsValid() bool
- func (i LabelTypes) MarshalText() ([]byte, error)
- func (i *LabelTypes) SetInt64(in int64)
- func (i *LabelTypes) SetString(s string) error
- func (i LabelTypes) String() string
- func (i *LabelTypes) UnmarshalText(text []byte) error
- func (i LabelTypes) Values() []enums.Enum
- type LabeledTextField
- func (lt *LabeledTextField) ConfigParts()
- func (lt *LabeledTextField) ConfigWidget()
- func (t *LabeledTextField) KiType() *gti.Type
- func (t *LabeledTextField) New() ki.Ki
- func (t *LabeledTextField) SetClass(v string) *LabeledTextField
- func (t *LabeledTextField) SetComplete(v *Complete) *LabeledTextField
- func (t *LabeledTextField) SetCursorColor(v image.Image) *LabeledTextField
- func (t *LabeledTextField) SetCursorWidth(v units.Value) *LabeledTextField
- func (t *LabeledTextField) SetCustomContextMenu(v func(m *Scene)) *LabeledTextField
- func (t *LabeledTextField) SetErrorText(v string) *LabeledTextField
- func (t *LabeledTextField) SetHintText(v string) *LabeledTextField
- func (t *LabeledTextField) SetLabel(v string) *LabeledTextField
- func (t *LabeledTextField) SetLeadingIconOnClick(v func(e events.Event)) *LabeledTextField
- func (t *LabeledTextField) SetMaxWidthReq(v int) *LabeledTextField
- func (t *LabeledTextField) SetNoEcho(v bool) *LabeledTextField
- func (t *LabeledTextField) SetPlaceholder(v string) *LabeledTextField
- func (t *LabeledTextField) SetPlaceholderColor(v color.RGBA) *LabeledTextField
- func (t *LabeledTextField) SetSelectColor(v image.Image) *LabeledTextField
- func (t *LabeledTextField) SetSelectMode(v bool) *LabeledTextField
- func (t *LabeledTextField) SetTooltip(v string) *LabeledTextField
- func (t *LabeledTextField) SetTrailingIconOnClick(v func(e events.Event)) *LabeledTextField
- func (t *LabeledTextField) SetType(v TextFieldTypes) *LabeledTextField
- type Labeler
- type LayCell
- type LayCells
- type LayImplState
- func (ls *LayImplState) Cell(d mat32.Dims, dIdx, odIdx int) *LayCell
- func (ls *LayImplState) CellsSize() mat32.Vec2
- func (ls *LayImplState) ColWidth(row, col int) (float32, error)
- func (ls *LayImplState) InitCells()
- func (ls *LayImplState) RowHeight(row, col int) (float32, error)
- func (ls *LayImplState) ShapeCheck(w Widget, phase string) bool
- func (ls *LayImplState) String() string
- func (ls *LayImplState) WrapIdxToCoord(idx int) image.Point
- type Layout
- func (t *Layout) AsLayout() *Layout
- func (ly *Layout) AutoScroll(pos image.Point) bool
- func (ly *Layout) AutoScrollDim(d mat32.Dims, sti, posi int) bool
- func (ly *Layout) ChildWithFocus() (Widget, int)
- func (ly *Layout) ClosePopup() bool
- func (ly *Layout) ConfigScroll(d mat32.Dims)
- func (ly *Layout) ConfigScrolls()
- func (ly *Layout) CopyFieldsFrom(frm any)
- func (ly *Layout) DeleteScroll(d mat32.Dims)
- func (ly *Layout) Destroy()
- func (ly *Layout) FlagType() enums.BitFlagSetter
- func (ly *Layout) FocusNextChild(updn bool) bool
- func (ly *Layout) FocusOnName(e events.Event) bool
- func (ly *Layout) FocusPrevChild(updn bool) bool
- func (ly *Layout) GetScrollPosition()
- func (ly *Layout) HandleEvents()
- func (ly *Layout) HandleKeys()
- func (ly *Layout) HasAnyScroll() bool
- func (t *Layout) KiType() *gti.Type
- func (ly *Layout) LaySetContentFitOverflow(nsz mat32.Vec2, pass LayoutPasses)
- func (ly *Layout) LaySetGapSizeFromCells()
- func (ly *Layout) LaySetInitCells()
- func (ly *Layout) LaySetInitCellsFlex()
- func (ly *Layout) LaySetInitCellsGrid()
- func (ly *Layout) LaySetInitCellsStacked()
- func (ly *Layout) LaySetInitCellsWrap()
- func (ly *Layout) LaySetWrapIdxs()
- func (ly *Layout) LayoutSpace()
- func (ly *Layout) ManageOverflow(iter int, updtSize bool) bool
- func (t *Layout) New() ki.Ki
- func (ly *Layout) OnInit()
- func (ly *Layout) Position()
- func (ly *Layout) PositionCells()
- func (ly *Layout) PositionCellsMainX()
- func (ly *Layout) PositionCellsMainY()
- func (ly *Layout) PositionLay()
- func (ly *Layout) PositionScroll(d mat32.Dims)
- func (ly *Layout) PositionScrolls()
- func (ly *Layout) PositionStacked()
- func (ly *Layout) PositionWrap()
- func (ly *Layout) Render()
- func (ly *Layout) RenderChildren()
- func (ly *Layout) RenderScrolls()
- func (ly *Layout) ScenePos()
- func (ly *Layout) ScenePosChildren()
- func (ly *Layout) ScenePosLay()
- func (ly *Layout) ScrollActionDelta(d mat32.Dims, delta float32)
- func (ly *Layout) ScrollActionPos(d mat32.Dims, pos float32)
- func (ly *Layout) ScrollDelta(e events.Event)
- func (ly *Layout) ScrollDimToCenter(d mat32.Dims, posi int) bool
- func (ly *Layout) ScrollDimToEnd(d mat32.Dims, posi int) bool
- func (ly *Layout) ScrollDimToStart(d mat32.Dims, posi int) bool
- func (ly *Layout) ScrollGeom(d mat32.Dims) (pos, sz mat32.Vec2)
- func (ly *Layout) ScrollToBox(box image.Rectangle) bool
- func (ly *Layout) ScrollToBoxDim(d mat32.Dims, tmini, tmaxi int) bool
- func (ly *Layout) ScrollToItem(wi Widget) bool
- func (ly *Layout) ScrollToPos(d mat32.Dims, pos float32)
- func (t *Layout) SetClass(v string) *Layout
- func (t *Layout) SetCustomContextMenu(v func(m *Scene)) *Layout
- func (ly *Layout) SetScrollsOff()
- func (t *Layout) SetStackTop(v int) *Layout
- func (ly *Layout) SetStyles()
- func (t *Layout) SetTooltip(v string) *Layout
- func (ly *Layout) SizeDown(iter int) bool
- func (ly *Layout) SizeDownAllocActual(iter int)
- func (ly *Layout) SizeDownAllocActualCells(iter int)
- func (ly *Layout) SizeDownAllocActualStacked(iter int)
- func (ly *Layout) SizeDownChildren(iter int) bool
- func (ly *Layout) SizeDownGrow(iter int, extra mat32.Vec2) bool
- func (ly *Layout) SizeDownGrowCells(iter int, extra mat32.Vec2) bool
- func (ly *Layout) SizeDownGrowStacked(iter int, extra mat32.Vec2) bool
- func (ly *Layout) SizeDownLay(iter int) bool
- func (ly *Layout) SizeDownSetAllocs(iter int)
- func (ly *Layout) SizeDownWrap(iter int) bool
- func (ly *Layout) SizeFinal()
- func (ly *Layout) SizeFinalChildren()
- func (ly *Layout) SizeFinalLay()
- func (ly *Layout) SizeFinalUpdateChildrenSizes()
- func (ly *Layout) SizeFromChildren(iter int, pass LayoutPasses) mat32.Vec2
- func (ly *Layout) SizeFromChildrenCells(iter int, pass LayoutPasses) mat32.Vec2
- func (ly *Layout) SizeFromChildrenFit(iter int, pass LayoutPasses)
- func (ly *Layout) SizeFromChildrenStacked() mat32.Vec2
- func (ly *Layout) SizeUp()
- func (ly *Layout) SizeUpChildren()
- func (ly *Layout) SizeUpLay()
- func (ly *Layout) StackTopWidget() (Widget, *WidgetBase)
- func (ly *Layout) UpdateStackedVisibility()
- type LayoutFlags
- func (i LayoutFlags) BitIndexString() string
- func (i LayoutFlags) Desc() string
- func (i LayoutFlags) HasFlag(f enums.BitFlag) bool
- func (i LayoutFlags) Int64() int64
- func (i LayoutFlags) IsValid() bool
- func (i LayoutFlags) MarshalText() ([]byte, error)
- func (i *LayoutFlags) SetFlag(on bool, f ...enums.BitFlag)
- func (i *LayoutFlags) SetInt64(in int64)
- func (i *LayoutFlags) SetString(s string) error
- func (i *LayoutFlags) SetStringOr(s string) error
- func (i LayoutFlags) String() string
- func (i *LayoutFlags) UnmarshalText(text []byte) error
- func (i LayoutFlags) Values() []enums.Enum
- type LayoutPasses
- func (i LayoutPasses) Desc() string
- func (i LayoutPasses) Int64() int64
- func (i LayoutPasses) IsValid() bool
- func (i LayoutPasses) MarshalText() ([]byte, error)
- func (i *LayoutPasses) SetInt64(in int64)
- func (i *LayoutPasses) SetString(s string) error
- func (i LayoutPasses) String() string
- func (i *LayoutPasses) UnmarshalText(text []byte) error
- func (i LayoutPasses) Values() []enums.Enum
- type Layouter
- type NewItemsData
- type ParamPrefs
- type PrefsDebug
- type PrefsDetailed
- type ProgressBar
- func (pb *ProgressBar) CopyFieldsFrom(frm any)
- func (t *ProgressBar) KiType() *gti.Type
- func (t *ProgressBar) New() ki.Ki
- func (pb *ProgressBar) OnInit()
- func (pb *ProgressBar) ProgStep()
- func (t *ProgressBar) SetClass(v string) *ProgressBar
- func (t *ProgressBar) SetCustomContextMenu(v func(m *Scene)) *ProgressBar
- func (t *ProgressBar) SetDim(v mat32.Dims) *ProgressBar
- func (t *ProgressBar) SetIcon(v icons.Icon) *ProgressBar
- func (t *ProgressBar) SetInputThreshold(v float32) *ProgressBar
- func (t *ProgressBar) SetMax(v float32) *ProgressBar
- func (t *ProgressBar) SetMin(v float32) *ProgressBar
- func (t *ProgressBar) SetPageStep(v float32) *ProgressBar
- func (t *ProgressBar) SetPrec(v int) *ProgressBar
- func (t *ProgressBar) SetProgCur(v int) *ProgressBar
- func (t *ProgressBar) SetProgInc(v int) *ProgressBar
- func (t *ProgressBar) SetProgMax(v int) *ProgressBar
- func (t *ProgressBar) SetSnap(v bool) *ProgressBar
- func (t *ProgressBar) SetStayInView(v bool) *ProgressBar
- func (t *ProgressBar) SetStep(v float32) *ProgressBar
- func (pb *ProgressBar) SetStyles()
- func (t *ProgressBar) SetThumbColor(v image.Image) *ProgressBar
- func (t *ProgressBar) SetThumbSize(v mat32.Vec2) *ProgressBar
- func (t *ProgressBar) SetTooltip(v string) *ProgressBar
- func (t *ProgressBar) SetTrackSize(v float32) *ProgressBar
- func (t *ProgressBar) SetValueColor(v image.Image) *ProgressBar
- func (pb *ProgressBar) Start(mx int)
- func (pb *ProgressBar) UpdtBar()
- type RenderContext
- func (rc *RenderContext) HasFlag(flag enums.BitFlag) bool
- func (rc *RenderContext) ReadLock()
- func (rc *RenderContext) ReadUnlock()
- func (rc *RenderContext) SetFlag(on bool, flag ...enums.BitFlag)
- func (rc *RenderContext) String() string
- func (rc *RenderContext) WriteLock()
- func (rc *RenderContext) WriteUnlock()
- type RenderContextFlags
- func (i RenderContextFlags) BitIndexString() string
- func (i RenderContextFlags) Desc() string
- func (i RenderContextFlags) HasFlag(f enums.BitFlag) bool
- func (i RenderContextFlags) Int64() int64
- func (i RenderContextFlags) IsValid() bool
- func (i RenderContextFlags) MarshalText() ([]byte, error)
- func (i *RenderContextFlags) SetFlag(on bool, f ...enums.BitFlag)
- func (i *RenderContextFlags) SetInt64(in int64)
- func (i *RenderContextFlags) SetString(s string) error
- func (i *RenderContextFlags) SetStringOr(s string) error
- func (i RenderContextFlags) String() string
- func (i *RenderContextFlags) UnmarshalText(text []byte) error
- func (i RenderContextFlags) Values() []enums.Enum
- type RenderParams
- type RenderScenes
- type RenderWin
- func (w *RenderWin) Close()
- func (w *RenderWin) CloseReq()
- func (w *RenderWin) Closed()
- func (w *RenderWin) DrawScenes()
- func (w *RenderWin) EventLoop()
- func (w *RenderWin) GatherScenes() bool
- func (w *RenderWin) GoStartEventLoop()
- func (w *RenderWin) HandleEvent(e events.Event)
- func (w *RenderWin) HandleWindowEvents(e events.Event)
- func (w *RenderWin) HasFlag(flag enums.BitFlag) bool
- func (w *RenderWin) Is(flag enums.BitFlag) bool
- func (w *RenderWin) IsClosed() bool
- func (w *RenderWin) IsVisible() bool
- func (w *RenderWin) LogicalDPI() float32
- func (w *RenderWin) MainScene() *Scene
- func (w *RenderWin) Minimize()
- func (w *RenderWin) Raise()
- func (w *RenderWin) RenderCtx() *RenderContext
- func (w *RenderWin) RenderWindow()
- func (w *RenderWin) Resized(sz image.Point)
- func (w *RenderWin) SendCustomEvent(data any)
- func (w *RenderWin) SendShowEvents()
- func (w *RenderWin) SendWinFocusEvent(act events.WinActions)
- func (w *RenderWin) SetCloseCleanFunc(fun func(win *RenderWin))
- func (w *RenderWin) SetCloseReqFunc(fun func(win *RenderWin))
- func (w *RenderWin) SetFlag(on bool, flag ...enums.BitFlag)
- func (w *RenderWin) SetName(name string)
- func (w *RenderWin) SetSize(sz image.Point)
- func (w *RenderWin) SetTitle(name string)
- func (w *RenderWin) SetWinSize(sz image.Point)
- func (w *RenderWin) StartEventLoop()
- func (w *RenderWin) StopEventLoop()
- func (w *RenderWin) ZoomDPI(steps int)
- type RenderWinGeom
- type RenderWinList
- func (wl *RenderWinList) Add(w *RenderWin)
- func (wl *RenderWinList) Delete(w *RenderWin) bool
- func (wl *RenderWinList) FindData(data any) (*RenderWin, bool)
- func (wl *RenderWinList) FindName(name string) (*RenderWin, bool)
- func (wl *RenderWinList) FindRenderWin(osw goosi.Window) (*RenderWin, bool)
- func (wl *RenderWinList) FocusNext() (*RenderWin, int)
- func (wl *RenderWinList) Focused() (*RenderWin, int)
- func (wl *RenderWinList) Len() int
- func (wl *RenderWinList) Win(idx int) *RenderWin
- type SVG
- func (sv *SVG) ConfigToolbar(tb *Toolbar)
- func (sv *SVG) CopyFieldsFrom(frm any)
- func (sv *SVG) DrawIntoScene()
- func (sv *SVG) HandleEvents()
- func (t *SVG) KiType() *gti.Type
- func (t *SVG) New() ki.Ki
- func (sv *SVG) OnInit()
- func (sv *SVG) OpenSVG(filename FileName) error
- func (sv *SVG) Render()
- func (sv *SVG) SavePNG(filename FileName) error
- func (sv *SVG) SaveSVG(filename FileName) error
- func (t *SVG) SetClass(v string) *SVG
- func (t *SVG) SetCustomContextMenu(v func(m *Scene)) *SVG
- func (sv *SVG) SetStyles()
- func (t *SVG) SetTooltip(v string) *SVG
- func (sv *SVG) SizeFinal()
- type ScFlags
- func (i ScFlags) BitIndexString() string
- func (i ScFlags) Desc() string
- func (i ScFlags) HasFlag(f enums.BitFlag) bool
- func (i ScFlags) Int64() int64
- func (i ScFlags) IsValid() bool
- func (i ScFlags) MarshalText() ([]byte, error)
- func (i *ScFlags) SetFlag(on bool, f ...enums.BitFlag)
- func (i *ScFlags) SetInt64(in int64)
- func (i *ScFlags) SetString(s string) error
- func (i *ScFlags) SetStringOr(s string) error
- func (i ScFlags) String() string
- func (i *ScFlags) UnmarshalText(text []byte) error
- func (i ScFlags) Values() []enums.Enum
- type Scene
- func AsScene(k ki.Ki) *Scene
- func NewBodyScene(body *Body, name ...string) *Scene
- func NewMenuFromStrings(strs []string, sel string, fun func(idx int)) *Scene
- func NewMenuScene(menu func(m *Scene), name ...string) *Scene
- func NewScene(name ...string) *Scene
- func NewSnackbar(ctx Widget, name ...string) *Scene
- func NewTooltipScene(w Widget, tooltip string, pos, sz image.Point) *Scene
- func (sc *Scene) AddAppBar(fun func(tb *Toolbar))
- func (sc *Scene) AddCancel(pw Widget, name ...string) *Button
- func (sc *Scene) AddOk(pw Widget, name ...string) *Button
- func (sc *Scene) AddOkOnly() *Scene
- func (sc *Scene) AddReRender(w Widget)
- func (sc *Scene) AddSnackbarButton(text string, onClick ...func(e events.Event)) *Scene
- func (sc *Scene) AddSnackbarIcon(icon icons.Icon, onClick ...func(e events.Event)) *Scene
- func (sc *Scene) AddSnackbarText(text string) *Scene
- func (sc *Scene) ApplyStyleScene()
- func (t *Scene) AsScene() *Scene
- func (sc *Scene) AssertPixels(t images.TestingT, filename string)
- func (sc *Scene) AssertPixelsOnShow(t images.TestingT, filename string, fun ...func())
- func (sc *Scene) BenchmarkFullRender()
- func (sc *Scene) BenchmarkReRender()
- func (sc *Scene) Close()
- func (sc *Scene) ConfigSceneBars()
- func (sc *Scene) ConfigSceneWidgets()
- func (sc *Scene) Delete(destroy bool)
- func (sc *Scene) DeleteImpl()
- func (sc *Scene) DeleteSnackbar()
- func (sc *Scene) DialogStyles()
- func (sc *Scene) DoRebuild()
- func (sc *Scene) DoUpdate() bool
- func (sc *Scene) EncodePNG(w io.Writer) error
- func (sc *Scene) Fill()
- func (sc *Scene) FitInWindow(winGeom mat32.Geom2DInt)
- func (sc *Scene) FlagType() enums.BitFlagSetter
- func (sc *Scene) GetBar(side styles.SideIndexes) *Layout
- func (sc *Scene) GetTopAppBar() *Toolbar
- func (sc *Scene) InheritBars(osc *Scene)
- func (sc *Scene) InheritBarsWidget(wi Widget)
- func (t *Scene) KiType() *gti.Type
- func (sc *Scene) LayoutRenderScene()
- func (sc *Scene) LayoutScene()
- func (sc *Scene) MainStageMgr() *StageMgr
- func (t *Scene) New() ki.Ki
- func (sc *Scene) NewDialog(ctx Widget, name ...string) *Stage
- func (sc *Scene) NewFullDialog(ctx Widget, name ...string) *Stage
- func (sc *Scene) NewWindow() *Stage
- func (sc *Scene) OnInit()
- func (sc *Scene) PrefSize(initSz image.Point) image.Point
- func (sc *Scene) RenderCtx() *RenderContext
- func (sc *Scene) RenderWin() *RenderWin
- func (sc *Scene) ReportWinNodes()
- func (sc *Scene) Resize(nwsz image.Point)
- func (sc *Scene) SavePNG(path string) error
- func (sc *Scene) ScIsVisible() bool
- func (t *Scene) SetApp(v *App) *Scene
- func (t *Scene) SetAppBars(v ToolbarFuncs) *Scene
- func (t *Scene) SetBackground(v image.Image) *Scene
- func (t *Scene) SetBars(v styles.Sides[BarFuncs]) *Scene
- func (t *Scene) SetBarsInherit(v styles.Sides[bool]) *Scene
- func (t *Scene) SetBody(v *Body) *Scene
- func (t *Scene) SetClass(v string) *Scene
- func (t *Scene) SetCustomContextMenu(v func(m *Scene)) *Scene
- func (t *Scene) SetData(v any) *Scene
- func (t *Scene) SetReRender(v []Widget) *Scene
- func (t *Scene) SetSelectedWidget(v Widget) *Scene
- func (t *Scene) SetSelectedWidgetChan(v chan Widget) *Scene
- func (t *Scene) SetStackTop(v int) *Scene
- func (t *Scene) SetStripes(v Stripes) *Scene
- func (sc *Scene) SetStyles()
- func (t *Scene) SetTooltip(v string) *Scene
- func (sc *Scene) SnackbarStyles()
- type SceneEmbedder
- type ScreenPrefs
- type Separator
- func (sp *Separator) CopyFieldsFrom(frm any)
- func (t *Separator) KiType() *gti.Type
- func (t *Separator) New() ki.Ki
- func (sp *Separator) OnInit()
- func (t *Separator) SetClass(v string) *Separator
- func (t *Separator) SetCustomContextMenu(v func(m *Scene)) *Separator
- func (t *Separator) SetDim(v mat32.Dims) *Separator
- func (sp *Separator) SetStyles()
- func (t *Separator) SetTooltip(v string) *Separator
- type Settings
- type SettingsBase
- type Shortcuts
- type SliceLabeler
- type Slider
- func (t *Slider) AsSlider() *Slider
- func (sr *Slider) ConfigParts()
- func (sr *Slider) ConfigSlider()
- func (sr *Slider) ConfigWidget()
- func (sr *Slider) CopyFieldsFrom(frm any)
- func (sr *Slider) EffectiveMax() float32
- func (sr *Slider) HandleEvents()
- func (sr *Slider) HandleKeys()
- func (sr *Slider) HandleMouse()
- func (t *Slider) KiType() *gti.Type
- func (t *Slider) New() ki.Ki
- func (sr *Slider) OnInit()
- func (sr *Slider) PointToRelPos(pt image.Point) float32
- func (sr *Slider) Render()
- func (sr *Slider) RenderSlider()
- func (sr *Slider) ScenePos()
- func (sr *Slider) ScrollThumbValue() float32
- func (sr *Slider) SendChanged(e ...events.Event) bool
- func (t *Slider) SetClass(v string) *Slider
- func (t *Slider) SetCustomContextMenu(v func(m *Scene)) *Slider
- func (t *Slider) SetDim(v mat32.Dims) *Slider
- func (t *Slider) SetIcon(v icons.Icon) *Slider
- func (t *Slider) SetInputThreshold(v float32) *Slider
- func (t *Slider) SetMax(v float32) *Slider
- func (t *Slider) SetMin(v float32) *Slider
- func (t *Slider) SetPageStep(v float32) *Slider
- func (sr *Slider) SetPosFromValue(val float32)
- func (t *Slider) SetPrec(v int) *Slider
- func (sr *Slider) SetSliderPos(pos float32)
- func (sr *Slider) SetSliderPosAction(pos float32)
- func (t *Slider) SetSnap(v bool) *Slider
- func (t *Slider) SetStayInView(v bool) *Slider
- func (t *Slider) SetStep(v float32) *Slider
- func (sr *Slider) SetStyles()
- func (t *Slider) SetThumbColor(v image.Image) *Slider
- func (t *Slider) SetThumbSize(v mat32.Vec2) *Slider
- func (t *Slider) SetTooltip(v string) *Slider
- func (t *Slider) SetTrackSize(v float32) *Slider
- func (sr *Slider) SetType(typ SliderTypes) *Slider
- func (sr *Slider) SetValue(val float32) *Slider
- func (sr *Slider) SetValueAction(val float32)
- func (t *Slider) SetValueColor(v image.Image) *Slider
- func (sr *Slider) SetVisiblePct(val float32) *Slider
- func (sr *Slider) SlideThumbSize() float32
- func (sr *Slider) SliderSize() float32
- func (sr *Slider) SliderThickness() float32
- func (sr *Slider) SnapValue()
- func (sr *Slider) ThumbSizeDots() mat32.Vec2
- type SliderEmbedder
- type SliderTypes
- func (i SliderTypes) Desc() string
- func (i SliderTypes) Int64() int64
- func (i SliderTypes) IsValid() bool
- func (i SliderTypes) MarshalText() ([]byte, error)
- func (i *SliderTypes) SetInt64(in int64)
- func (i *SliderTypes) SetString(s string) error
- func (i SliderTypes) String() string
- func (i *SliderTypes) UnmarshalText(text []byte) error
- func (i SliderTypes) Values() []enums.Enum
- type Space
- type Spell
- func (sp *Spell) Cancel() bool
- func (sp *Spell) CheckWord(word string) ([]string, bool)
- func (sp *Spell) IgnoreWord()
- func (sp *Spell) IsLastLearned(wrd string) bool
- func (sp *Spell) LearnWord()
- func (sp *Spell) On(etype events.Types, fun func(e events.Event))
- func (sp *Spell) OnSelect(fun func(e events.Event))
- func (t *Spell) SetSrcCh(v int) *Spell
- func (t *Spell) SetSrcLn(v int) *Spell
- func (t *Spell) SetStage(v *Stage) *Spell
- func (t *Spell) SetSuggest(v []string) *Spell
- func (sp *Spell) SetWord(word string, sugs []string, srcLn, srcCh int) *Spell
- func (sp *Spell) Show(text string, ctx Widget, pos image.Point)
- func (sp *Spell) ShowNow(word string, ctx Widget, pos image.Point)
- func (sp *Spell) Spell(s string)
- func (sp *Spell) UnLearnLast()
- type SpellSignals
- func (i SpellSignals) Desc() string
- func (i SpellSignals) Int64() int64
- func (i SpellSignals) IsValid() bool
- func (i SpellSignals) MarshalText() ([]byte, error)
- func (i *SpellSignals) SetInt64(in int64)
- func (i *SpellSignals) SetString(s string) error
- func (i SpellSignals) String() string
- func (i *SpellSignals) UnmarshalText(text []byte) error
- func (i SpellSignals) Values() []enums.Enum
- type Spinner
- func (t *Spinner) AsSpinner() *Spinner
- func (sp *Spinner) CopyFieldsFrom(frm any)
- func (sp *Spinner) FormatIsInt() bool
- func (sp *Spinner) HandleEvents()
- func (sp *Spinner) HandleKeys()
- func (sp *Spinner) IncrValue(steps float32) *Spinner
- func (t *Spinner) KiType() *gti.Type
- func (t *Spinner) New() ki.Ki
- func (sp *Spinner) OnInit()
- func (sp *Spinner) PageIncrValue(steps float32) *Spinner
- func (t *Spinner) SetClass(v string) *Spinner
- func (t *Spinner) SetComplete(v *Complete) *Spinner
- func (t *Spinner) SetCursorColor(v image.Image) *Spinner
- func (t *Spinner) SetCursorWidth(v units.Value) *Spinner
- func (t *Spinner) SetCustomContextMenu(v func(m *Scene)) *Spinner
- func (t *Spinner) SetFormat(v string) *Spinner
- func (t *Spinner) SetLeadingIconOnClick(v func(e events.Event)) *Spinner
- func (sp *Spinner) SetMax(max float32) *Spinner
- func (t *Spinner) SetMaxWidthReq(v int) *Spinner
- func (sp *Spinner) SetMin(min float32) *Spinner
- func (sp *Spinner) SetMinMax(hasMin bool, min float32, hasMax bool, max float32) *Spinner
- func (t *Spinner) SetNoEcho(v bool) *Spinner
- func (t *Spinner) SetPageStep(v float32) *Spinner
- func (t *Spinner) SetPlaceholder(v string) *Spinner
- func (t *Spinner) SetPlaceholderColor(v color.RGBA) *Spinner
- func (t *Spinner) SetPrec(v int) *Spinner
- func (t *Spinner) SetSelectColor(v image.Image) *Spinner
- func (t *Spinner) SetSelectMode(v bool) *Spinner
- func (t *Spinner) SetStep(v float32) *Spinner
- func (sp *Spinner) SetStyles()
- func (sp *Spinner) SetTextToValue()
- func (t *Spinner) SetTooltip(v string) *Spinner
- func (t *Spinner) SetTrailingIconOnClick(v func(e events.Event)) *Spinner
- func (t *Spinner) SetType(v TextFieldTypes) *Spinner
- func (sp *Spinner) SetValue(val float32) *Spinner
- func (sp *Spinner) SetValueAction(val float32) *Spinner
- func (sp *Spinner) SizeUp()
- func (sp *Spinner) StringToVal(str string) (float32, error)
- func (sp *Spinner) ValToString(val float32) string
- type SpinnerEmbedder
- type Splits
- func (sl *Splits) ApplyStyle()
- func (t *Splits) AsSplits() *Splits
- func (sl *Splits) CollapseChild(save bool, idxs ...int)
- func (sl *Splits) ConfigSplitters()
- func (sl *Splits) ConfigWidget()
- func (sl *Splits) CopyFieldsFrom(frm any)
- func (sl *Splits) EvenSplits()
- func (sl *Splits) HandleEvents()
- func (sl *Splits) IsCollapsed(idx int) bool
- func (t *Splits) KiType() *gti.Type
- func (t *Splits) New() ki.Ki
- func (sl *Splits) OnInit()
- func (sl *Splits) Position()
- func (sl *Splits) PositionSplits()
- func (sl *Splits) Render()
- func (sl *Splits) RestoreChild(idxs ...int)
- func (sl *Splits) RestoreSplits()
- func (sl *Splits) SaveSplits()
- func (t *Splits) SetClass(v string) *Splits
- func (t *Splits) SetCustomContextMenu(v func(m *Scene)) *Splits
- func (t *Splits) SetDim(v mat32.Dims) *Splits
- func (sl *Splits) SetSplitAction(idx int, nwval float32)
- func (sl *Splits) SetSplits(splits ...float32) *Splits
- func (sl *Splits) SetSplitsAction(splits ...float32) *Splits
- func (sl *Splits) SetSplitsList(splits []float32) *Splits
- func (t *Splits) SetStackTop(v int) *Splits
- func (sl *Splits) SetStyles()
- func (t *Splits) SetTooltip(v string) *Splits
- func (sl *Splits) SizeDownSetAllocs(iter int)
- func (sl *Splits) UpdateSplits()
- type SplitsEmbedder
- type Sprite
- type Sprites
- func (ss *Sprites) ActivateSprite(name string)
- func (ss *Sprites) Add(sp *Sprite)
- func (ss *Sprites) AllocSizes()
- func (ss *Sprites) ConfigSprites(drw goosi.Drawer)
- func (ss *Sprites) Delete(sp *Sprite)
- func (ss *Sprites) DrawSprites(drw goosi.Drawer)
- func (ss *Sprites) HasSizeChanged() bool
- func (ss *Sprites) InactivateAllSprites()
- func (ss *Sprites) InactivateSprite(name string)
- func (ss *Sprites) Init()
- func (ss *Sprites) Reset()
- func (ss *Sprites) SpriteByName(name string) (*Sprite, bool)
- type Stage
- func NewCompleter(sc *Scene, ctx Widget) *Stage
- func NewMainStage(typ StageTypes, sc *Scene) *Stage
- func NewMenu(menu func(m *Scene), ctx Widget, pos image.Point) *Stage
- func NewMenuStage(sc *Scene, ctx Widget, pos image.Point) *Stage
- func NewPopupStage(typ StageTypes, sc *Scene, ctx Widget) *Stage
- func NewSheet(sc *Scene, side StageSides) *Stage
- func NewTooltip(w Widget) *Stage
- func NewTooltipFromScene(sc *Scene, ctx Widget) *Stage
- func NewTooltipText(w Widget, tooltip string) *Stage
- func NewTooltipTextAt(w Widget, tooltip string, pos, sz image.Point) *Stage
- func (st *Stage) AddDialogDecor() *Stage
- func (st *Stage) AddSheetDecor() *Stage
- func (st *Stage) AddWindowDecor() *Stage
- func (st *Stage) ClosePopup()
- func (st *Stage) ConfigMainStage()
- func (st *Stage) Delete()
- func (st *Stage) DoUpdate() (stageMods, sceneMods bool)
- func (st *Stage) FirstWinManager() *StageMgr
- func (st *Stage) InheritBars()
- func (st *Stage) MainHandleEvent(e events.Event)
- func (st *Stage) NewRenderWin() *RenderWin
- func (st *Stage) PopupHandleEvent(e events.Event)
- func (st *Stage) Resize(sz image.Point)
- func (st *Stage) Run() *Stage
- func (st *Stage) RunDialog() *Stage
- func (st *Stage) RunPopup() *Stage
- func (st *Stage) RunSheet() *Stage
- func (st *Stage) RunWindow() *Stage
- func (t *Stage) SetClickOff(v bool) *Stage
- func (t *Stage) SetCloseable(v bool) *Stage
- func (t *Stage) SetContext(v Widget) *Stage
- func (t *Stage) SetData(v any) *Stage
- func (t *Stage) SetFullWindow(v bool) *Stage
- func (t *Stage) SetIgnoreEvents(v bool) *Stage
- func (t *Stage) SetMain(v *Stage) *Stage
- func (st *Stage) SetMainMgr(sm *StageMgr) *Stage
- func (t *Stage) SetModal(v bool) *Stage
- func (t *Stage) SetMovable(v bool) *Stage
- func (t *Stage) SetName(v string) *Stage
- func (st *Stage) SetNameFromScene() *Stage
- func (t *Stage) SetNewWindow(v bool) *Stage
- func (st *Stage) SetPopupMgr(mainSt *Stage) *Stage
- func (t *Stage) SetPos(v image.Point) *Stage
- func (t *Stage) SetRenderCtx(v *RenderContext) *Stage
- func (t *Stage) SetResizable(v bool) *Stage
- func (st *Stage) SetScene(sc *Scene) *Stage
- func (t *Stage) SetScrim(v bool) *Stage
- func (t *Stage) SetSide(v StageSides) *Stage
- func (t *Stage) SetSpriteDragging(v string) *Stage
- func (t *Stage) SetSprites(v Sprites) *Stage
- func (t *Stage) SetTimeout(v time.Duration) *Stage
- func (t *Stage) SetTitle(v string) *Stage
- func (st *Stage) SetType(typ StageTypes) *Stage
- func (st *Stage) String() string
- func (st *Stage) Wait() *Stage
- type StageMgr
- func (sm *StageMgr) DeleteAll()
- func (sm *StageMgr) DeleteStage(st *Stage) bool
- func (sm *StageMgr) MainHandleEvent(e events.Event)
- func (sm *StageMgr) Pop() *Stage
- func (sm *StageMgr) PopDelete()
- func (sm *StageMgr) PopDeleteType(typ StageTypes)
- func (sm *StageMgr) PopType(typ StageTypes) *Stage
- func (pm *StageMgr) PopupHandleEvent(e events.Event)
- func (sm *StageMgr) Push(st *Stage)
- func (sm *StageMgr) Resize(sz image.Point)
- func (sm *StageMgr) SendShowEvents()
- func (sm *StageMgr) Top() *Stage
- func (pm *StageMgr) TopIsModal() bool
- func (sm *StageMgr) TopNotType(typ StageTypes) *Stage
- func (sm *StageMgr) TopOfType(typ StageTypes) *Stage
- func (sm *StageMgr) UniqueName(nm string) string
- func (sm *StageMgr) UpdateAll() (stageMods, sceneMods bool)
- type StageSides
- func (i StageSides) Desc() string
- func (i StageSides) Int64() int64
- func (i StageSides) IsValid() bool
- func (i StageSides) MarshalText() ([]byte, error)
- func (i *StageSides) SetInt64(in int64)
- func (i *StageSides) SetString(s string) error
- func (i StageSides) String() string
- func (i *StageSides) UnmarshalText(text []byte) error
- func (i StageSides) Values() []enums.Enum
- type StageTypes
- func (i StageTypes) Desc() string
- func (i StageTypes) Int64() int64
- func (st StageTypes) IsMain() bool
- func (st StageTypes) IsPopup() bool
- func (i StageTypes) IsValid() bool
- func (i StageTypes) MarshalText() ([]byte, error)
- func (i *StageTypes) SetInt64(in int64)
- func (i *StageTypes) SetString(s string) error
- func (i StageTypes) String() string
- func (i *StageTypes) UnmarshalText(text []byte) error
- func (i StageTypes) Values() []enums.Enum
- type Stretch
- type Stripes
- func (i Stripes) Desc() string
- func (i Stripes) Int64() int64
- func (i Stripes) IsValid() bool
- func (i Stripes) MarshalText() ([]byte, error)
- func (i *Stripes) SetInt64(in int64)
- func (i *Stripes) SetString(s string) error
- func (i Stripes) String() string
- func (i *Stripes) UnmarshalText(text []byte) error
- func (i Stripes) Values() []enums.Enum
- type StyleSheet
- func (ss *StyleSheet) CSSProps() ki.Props
- func (ss *StyleSheet) CopyFieldsFrom(frm any)
- func (t *StyleSheet) KiType() *gti.Type
- func (t *StyleSheet) New() ki.Ki
- func (ss *StyleSheet) ParseString(str string) error
- func (t *StyleSheet) SetClass(v string) *StyleSheet
- func (t *StyleSheet) SetCustomContextMenu(v func(m *Scene)) *StyleSheet
- func (t *StyleSheet) SetSheet(v *css.Stylesheet) *StyleSheet
- func (t *StyleSheet) SetTooltip(v string) *StyleSheet
- type Switch
- func (sw *Switch) ClearIcons() *Switch
- func (sw *Switch) ConfigParts()
- func (sw *Switch) ConfigWidget()
- func (sw *Switch) CopyFieldsFrom(frm any)
- func (sw *Switch) HandleEvents()
- func (sw *Switch) IsChecked() bool
- func (t *Switch) KiType() *gti.Type
- func (sw *Switch) LabelWidget() *Label
- func (t *Switch) New() ki.Ki
- func (sw *Switch) OnInit()
- func (sw *Switch) Render()
- func (sw *Switch) RenderSwitch()
- func (sw *Switch) SetChecked(on bool) *Switch
- func (t *Switch) SetClass(v string) *Switch
- func (t *Switch) SetCustomContextMenu(v func(m *Scene)) *Switch
- func (sw *Switch) SetIconFromState()
- func (t *Switch) SetIconOff(v icons.Icon) *Switch
- func (t *Switch) SetIconOn(v icons.Icon) *Switch
- func (t *Switch) SetIconUnk(v icons.Icon) *Switch
- func (sw *Switch) SetIcons(on, off, unk icons.Icon) *Switch
- func (sw *Switch) SetIconsUpdate(on, off, unk icons.Icon) *Switch
- func (sw *Switch) SetStyles()
- func (t *Switch) SetText(v string) *Switch
- func (t *Switch) SetTooltip(v string) *Switch
- func (sw *Switch) SetType(typ SwitchTypes) *Switch
- type SwitchTypes
- func (i SwitchTypes) Desc() string
- func (i SwitchTypes) Int64() int64
- func (i SwitchTypes) IsValid() bool
- func (i SwitchTypes) MarshalText() ([]byte, error)
- func (i *SwitchTypes) SetInt64(in int64)
- func (i *SwitchTypes) SetString(s string) error
- func (i SwitchTypes) String() string
- func (i *SwitchTypes) UnmarshalText(text []byte) error
- func (i SwitchTypes) Values() []enums.Enum
- type Switches
- func (t *Switches) AsSwitches() *Switches
- func (sw *Switches) BitFlagValue(bitflag enums.BitFlagSetter)
- func (sw *Switches) ConfigItems()
- func (sw *Switches) ConfigSwitches()
- func (sw *Switches) ConfigWidget()
- func (sw *Switches) CopyFieldsFrom(frm any)
- func (sw *Switches) HandleSwitchEvents(swi *Switch)
- func (t *Switches) KiType() *gti.Type
- func (t *Switches) New() ki.Ki
- func (sw *Switches) OnInit()
- func (sw *Switches) SelectItem(idx int) error
- func (sw *Switches) SelectItemAction(idx int) error
- func (sw *Switches) SelectedItem() string
- func (t *Switches) SetClass(v string) *Switches
- func (t *Switches) SetCustomContextMenu(v func(m *Scene)) *Switches
- func (sw *Switches) SetEnum(enum enums.Enum) *Switches
- func (sw *Switches) SetEnums(el []enums.Enum) *Switches
- func (t *Switches) SetItems(v []string) *Switches
- func (t *Switches) SetMutex(v bool) *Switches
- func (t *Switches) SetStackTop(v int) *Switches
- func (sw *Switches) SetStrings(el []string) *Switches
- func (t *Switches) SetStripes(v Stripes) *Switches
- func (sw *Switches) SetStyles()
- func (t *Switches) SetTooltip(v string) *Switches
- func (t *Switches) SetTooltips(v []string) *Switches
- func (t *Switches) SetType(v SwitchTypes) *Switches
- func (sw *Switches) UnCheckAll()
- func (sw *Switches) UnCheckAllBut(idx int)
- func (sw *Switches) UpdateFromBitFlag(bitflag enums.BitFlag)
- type SwitchesEmbedder
- type Tab
- func (tb *Tab) ConfigParts()
- func (tb *Tab) ConfigPartsDeleteButton()
- func (tb *Tab) ConfigWidget()
- func (t *Tab) KiType() *gti.Type
- func (t *Tab) New() ki.Ki
- func (tb *Tab) OnInit()
- func (t *Tab) SetClass(v string) *Tab
- func (t *Tab) SetCustomContextMenu(v func(m *Scene)) *Tab
- func (t *Tab) SetData(v any) *Tab
- func (t *Tab) SetDeleteButton(v bool) *Tab
- func (t *Tab) SetIcon(v icons.Icon) *Tab
- func (t *Tab) SetIndicator(v icons.Icon) *Tab
- func (t *Tab) SetMaxChars(v int) *Tab
- func (t *Tab) SetMenu(v func(m *Scene)) *Tab
- func (t *Tab) SetShortcut(v key.Chord) *Tab
- func (tb *Tab) SetStyles()
- func (t *Tab) SetTooltip(v string) *Tab
- func (t *Tab) SetType(v ButtonTypes) *Tab
- func (tb *Tab) Tabs() *Tabs
- type Tabs
- func (ts *Tabs) AddTab(frame *Frame, label string) int
- func (t *Tabs) AsTabs() *Tabs
- func (ts *Tabs) ConfigNewTabButton() bool
- func (ts *Tabs) ConfigWidget()
- func (ts *Tabs) CopyFieldsFrom(frm any)
- func (ts *Tabs) CurTab() (Widget, int, bool)
- func (ts *Tabs) DeleteTabIndex(idx int, destroy bool) (*Frame, string, bool)
- func (ts *Tabs) Frame() *Frame
- func (ts *Tabs) InsertNewTab(label string, idx int) *Frame
- func (ts *Tabs) InsertTab(frame *Frame, label string, idx int)
- func (ts *Tabs) InsertTabOnlyAt(frame *Frame, label string, idx int)
- func (t *Tabs) KiType() *gti.Type
- func (ts *Tabs) NTabs() int
- func (t *Tabs) New() ki.Ki
- func (ts *Tabs) NewTab(label string) *Frame
- func (ts *Tabs) OnInit()
- func (ts *Tabs) RecycleTab(label string, sel bool) *Frame
- func (ts *Tabs) RecycleTabWidget(label string, sel bool, typ *gti.Type) Widget
- func (ts *Tabs) Render()
- func (ts *Tabs) RenumberTabs()
- func (ts *Tabs) SelectTabByLabel(label string) *Frame
- func (ts *Tabs) SelectTabIndex(idx int) (*Frame, bool)
- func (t *Tabs) SetClass(v string) *Tabs
- func (t *Tabs) SetCustomContextMenu(v func(m *Scene)) *Tabs
- func (t *Tabs) SetDeleteTabButtons(v bool) *Tabs
- func (t *Tabs) SetMaxChars(v int) *Tabs
- func (t *Tabs) SetNewTabButton(v bool) *Tabs
- func (t *Tabs) SetStackTop(v int) *Tabs
- func (ts *Tabs) SetStyles()
- func (t *Tabs) SetTooltip(v string) *Tabs
- func (ts *Tabs) TabAtIndex(idx int) (*Frame, *Tab, bool)
- func (ts *Tabs) TabByLabel(label string) *Frame
- func (ts *Tabs) TabIndexByLabel(label string) (int, bool)
- func (ts *Tabs) TabLabel(idx int) string
- func (ts *Tabs) Tabs() *Frame
- func (ts *Tabs) UnselectOtherTabs(idx int)
- type TabsEmbedder
- type TextField
- func (tf *TextField) AddClearButton() *TextField
- func (tf *TextField) ApplyStyle()
- func (t *TextField) AsTextField() *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) ConfigWidget()
- func (tf *TextField) ContextMenu(m *Scene)
- func (tf *TextField) Copy(reset bool)
- func (tf *TextField) CopyFieldsFrom(frm any)
- func (tf *TextField) CursorBackspace(steps int)
- func (tf *TextField) CursorBackspaceWord(steps int)
- func (tf *TextField) CursorBackward(steps int)
- func (tf *TextField) CursorBackwardWord(steps int)
- func (tf *TextField) CursorDelete(steps int)
- func (tf *TextField) CursorDeleteWord(steps int)
- func (tf *TextField) CursorEnd()
- func (tf *TextField) CursorForward(steps int)
- func (tf *TextField) CursorForwardWord(steps int)
- func (tf *TextField) CursorKill()
- func (tf *TextField) CursorSprite(on bool) *Sprite
- func (tf *TextField) CursorStart()
- func (tf *TextField) Cut()
- func (tf *TextField) DeleteSelection() string
- func (tf *TextField) EditDeFocused()
- func (tf *TextField) EditDone()
- func (tf *TextField) HandleEvents()
- func (tf *TextField) HandleKeys()
- func (tf *TextField) HandleMouse()
- func (tf *TextField) HandleStateFromFocus()
- func (tf *TextField) HasSelection() bool
- func (tf *TextField) InsertAtCursor(str string)
- func (tf *TextField) IsWordBreak(r rune) bool
- func (t *TextField) KiType() *gti.Type
- func (tf *TextField) LeadingIconButton() (*Button, bool)
- func (t *TextField) New() ki.Ki
- func (tf *TextField) OfferComplete(forceComplete bool)
- func (tf *TextField) OnAdd()
- func (tf *TextField) OnInit()
- func (tf *TextField) Paste()
- func (tf *TextField) PixelToCursor(pixOff float32) int
- func (tf *TextField) Render()
- func (tf *TextField) RenderCursor(on bool)
- func (tf *TextField) RenderSelect()
- func (tf *TextField) RenderTextField()
- func (tf *TextField) Revert()
- func (tf *TextField) ScenePos()
- 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 (t *TextField) SetClass(v string) *TextField
- func (t *TextField) SetComplete(v *Complete) *TextField
- func (tf *TextField) SetCompleter(data any, matchFun complete.MatchFunc, editFun complete.EditFunc)
- func (t *TextField) SetCursorColor(v image.Image) *TextField
- func (tf *TextField) SetCursorFromPixel(pixOff float32, selMode events.SelectModes)
- func (t *TextField) SetCursorWidth(v units.Value) *TextField
- func (t *TextField) SetCustomContextMenu(v func(m *Scene)) *TextField
- func (tf *TextField) SetEffPosAndSize()
- func (tf *TextField) SetLeadingIcon(icon icons.Icon, onClick ...func(e events.Event)) *TextField
- func (t *TextField) SetLeadingIconOnClick(v func(e events.Event)) *TextField
- func (tf *TextField) SetLeadingIconUpdate(icon icons.Icon, onClick ...func(e events.Event)) *TextField
- func (t *TextField) SetMaxWidthReq(v int) *TextField
- func (t *TextField) SetNoEcho(v bool) *TextField
- func (t *TextField) SetPlaceholder(v string) *TextField
- func (t *TextField) SetPlaceholderColor(v color.RGBA) *TextField
- func (t *TextField) SetSelectColor(v image.Image) *TextField
- func (t *TextField) SetSelectMode(v bool) *TextField
- func (tf *TextField) SetStyles()
- func (tf *TextField) SetText(txt string) *TextField
- func (tf *TextField) SetTextUpdate(txt string) *TextField
- func (t *TextField) SetTooltip(v string) *TextField
- func (tf *TextField) SetTrailingIcon(icon icons.Icon, onClick ...func(e events.Event)) *TextField
- func (t *TextField) SetTrailingIconOnClick(v func(e events.Event)) *TextField
- func (tf *TextField) SetTrailingIconUpdate(icon icons.Icon, onClick ...func(e events.Event)) *TextField
- func (t *TextField) SetType(v TextFieldTypes) *TextField
- func (tf *TextField) SetTypePassword() *TextField
- func (tf *TextField) ShiftSelect(e events.Event)
- func (tf *TextField) SizeUp()
- func (tf *TextField) StartCharPos(idx int) float32
- func (tf *TextField) StartCursor()
- func (tf *TextField) StopCursor()
- func (tf *TextField) StyleTextField()
- func (tf *TextField) Text() string
- func (tf *TextField) TextFieldContextMenu(m *Scene)
- func (tf *TextField) TextWidth(st, ed int) float32
- func (tf *TextField) TrailingIconButton() (*Button, bool)
- func (tf *TextField) UpdateRenderAll() bool
- type TextFieldEmbedder
- type TextFieldTypes
- func (i TextFieldTypes) Desc() string
- func (i TextFieldTypes) Int64() int64
- func (i TextFieldTypes) IsValid() bool
- func (i TextFieldTypes) MarshalText() ([]byte, error)
- func (i *TextFieldTypes) SetInt64(in int64)
- func (i *TextFieldTypes) SetString(s string) error
- func (i TextFieldTypes) String() string
- func (i *TextFieldTypes) UnmarshalText(text []byte) error
- func (i TextFieldTypes) Values() []enums.Enum
- type Themes
- func (i Themes) Desc() string
- func (i Themes) Int64() int64
- func (i Themes) IsValid() bool
- func (i Themes) MarshalText() ([]byte, error)
- func (i *Themes) SetInt64(in int64)
- func (i *Themes) SetString(s string) error
- func (i Themes) String() string
- func (i *Themes) UnmarshalText(text []byte) error
- func (i Themes) Values() []enums.Enum
- type Toolbar
- func (tb *Toolbar) AddOverflowMenu(fun func(m *Scene))
- func (tb *Toolbar) AllItemsToChildren()
- func (t *Toolbar) AsToolbar() *Toolbar
- func (tb *Toolbar) ConfigWidget()
- func (tb *Toolbar) CopyFieldsFrom(frm any)
- func (tb *Toolbar) DeleteShortcuts()
- func (tb *Toolbar) Destroy()
- func (tb *Toolbar) IsVisible() bool
- func (t *Toolbar) KiType() *gti.Type
- func (tb *Toolbar) MoveToOverflow()
- func (t *Toolbar) New() ki.Ki
- func (tb *Toolbar) OnInit()
- func (tb *Toolbar) OverflowMenu(m *Scene)
- func (tb *Toolbar) ParentSize() float32
- func (t *Toolbar) SetClass(v string) *Toolbar
- func (t *Toolbar) SetCustomContextMenu(v func(m *Scene)) *Toolbar
- func (t *Toolbar) SetOverflowButton(v *Button) *Toolbar
- func (tb *Toolbar) SetShortcuts()
- func (t *Toolbar) SetStackTop(v int) *Toolbar
- func (t *Toolbar) SetStripes(v Stripes) *Toolbar
- func (t *Toolbar) SetToolbarFuncs(v ToolbarFuncs) *Toolbar
- func (t *Toolbar) SetTooltip(v string) *Toolbar
- func (tb *Toolbar) SizeDown(iter int) bool
- func (tb *Toolbar) SizeFromChildren(iter int, pass LayoutPasses) mat32.Vec2
- func (tb *Toolbar) SizeUp()
- func (tb *Toolbar) StdOverflowMenu(m *Scene)
- func (tb *Toolbar) UpdateBar()
- type ToolbarEmbedder
- type ToolbarFuncs
- type Updater
- type User
- type ViewIFace
- type Widget
- type WidgetBase
- func (wb *WidgetBase) AbilityIs(able abilities.Abilities) bool
- func (wb *WidgetBase) AddClass(cls string) *WidgetBase
- func (wb *WidgetBase) AddPriorityEvent(etype events.Types)
- func (wb *WidgetBase) App() *App
- func (wb *WidgetBase) ApplyStyle()
- func (wb *WidgetBase) ApplyStyleParts()
- func (wb *WidgetBase) ApplyStylePrefs()
- func (wb *WidgetBase) ApplyStyleTree()
- func (wb *WidgetBase) ApplyStyleUpdate()
- func (wb *WidgetBase) ApplyStyleWidget()
- func (wb *WidgetBase) AsWidget() *WidgetBase
- func (wb *WidgetBase) BaseType() *gti.Type
- func (wb *WidgetBase) BoxSpace() styles.SideFloats
- func (wb *WidgetBase) CanFocus() bool
- func (wb *WidgetBase) Config()
- func (wb *WidgetBase) ConfigPartsImpl(config ki.Config)
- func (wb *WidgetBase) ConfigTree()
- func (wb *WidgetBase) ConfigWidget()
- func (wb *WidgetBase) ContainsFocus() bool
- func (wb *WidgetBase) ContextMenu(m *Scene)
- func (wb *WidgetBase) ContextMenuPos(e events.Event) image.Point
- func (wb *WidgetBase) CopyFieldsFrom(frm any)
- func (wb *WidgetBase) DeleteParts()
- func (wb *WidgetBase) Destroy()
- func (wb *WidgetBase) DirectWinUpload()
- func (wb *WidgetBase) DoNeedsRender()
- func (wb *WidgetBase) EventMgr() *EventMgr
- func (wb *WidgetBase) FlagType() enums.BitFlagSetter
- func (wb *WidgetBase) FocusClear()
- func (wb *WidgetBase) FocusNext()
- func (wb *WidgetBase) FocusPrev()
- func (wb *WidgetBase) FocusableInMe() Widget
- func (wb *WidgetBase) GrowToAlloc() bool
- func (wb *WidgetBase) GrowToAllocSize(act, alloc mat32.Vec2) (mat32.Vec2, bool)
- func (wb *WidgetBase) HandleClickOnEnterSpace()
- func (wb *WidgetBase) HandleEvent(ev events.Event)
- func (wb *WidgetBase) HandleEvents()
- func (wb *WidgetBase) HandleLongHoverTooltip()
- func (wb *WidgetBase) HandleSelectToggle()
- func (wb *WidgetBase) HandleWidgetClick()
- func (wb *WidgetBase) HandleWidgetContextMenu()
- func (wb *WidgetBase) HandleWidgetMagnify()
- func (wb *WidgetBase) HandleWidgetStateFromFocus()
- func (wb *WidgetBase) HandleWidgetStateFromMouse()
- func (wb *WidgetBase) HasClass(cls string) bool
- func (wb *WidgetBase) HasFlagWithin(flag enums.BitFlag) bool
- func (wb *WidgetBase) HasSc() bool
- func (wb *WidgetBase) HasStateWithin(state states.States) bool
- func (wb *WidgetBase) IsDirectWinUpload() bool
- func (wb *WidgetBase) IsDisabled() bool
- func (wb *WidgetBase) IsFirstChild() bool
- func (wb *WidgetBase) IsLastChild() bool
- func (wb *WidgetBase) IsNthChild(n int) bool
- func (wb *WidgetBase) IsOnlyChild() bool
- func (wb *WidgetBase) IsReadOnly() bool
- func (wb *WidgetBase) IsVisible() bool
- func (t *WidgetBase) KiType() *gti.Type
- func (wb *WidgetBase) NeedsRebuild() bool
- func (t *WidgetBase) New() ki.Ki
- func (wb *WidgetBase) NewParts() *Layout
- func (wb *WidgetBase) On(etype events.Types, fun func(e events.Event)) *WidgetBase
- func (wb *WidgetBase) OnAdd()
- func (wb *WidgetBase) OnChange(fun func(e events.Event)) *WidgetBase
- func (wb *WidgetBase) OnChildAdded(child ki.Ki)
- func (wb *WidgetBase) OnClick(fun func(e events.Event)) *WidgetBase
- func (wb *WidgetBase) OnClose(fun func(e events.Event)) *WidgetBase
- func (wb *WidgetBase) OnDoubleClick(fun func(e events.Event)) *WidgetBase
- func (wb *WidgetBase) OnFocus(fun func(e events.Event)) *WidgetBase
- func (wb *WidgetBase) OnFocusLost(fun func(e events.Event)) *WidgetBase
- func (wb *WidgetBase) OnInit()
- func (wb *WidgetBase) OnInput(fun func(e events.Event)) *WidgetBase
- func (wb *WidgetBase) OnKeyChord(fun func(e events.Event)) *WidgetBase
- func (wb *WidgetBase) OnLast(etype events.Types, fun func(e events.Event)) Widget
- func (wb *WidgetBase) OnSelect(fun func(e events.Event)) *WidgetBase
- func (wb *WidgetBase) OnShow(fun func(e events.Event)) *WidgetBase
- func (wb *WidgetBase) OnWidgetAdded(fun func(w Widget)) *WidgetBase
- func (wb *WidgetBase) ParentActualBackground() image.Image
- func (wb *WidgetBase) ParentLayout() *Layout
- func (wb *WidgetBase) ParentScrollLayout() *Layout
- func (wb *WidgetBase) ParentWidget() (Widget, *WidgetBase)
- func (wb *WidgetBase) ParentWidgetIf(fun func(p *WidgetBase) bool) (Widget, *WidgetBase)
- func (wb *WidgetBase) ParentWidgetIfTry(fun func(p *WidgetBase) bool) (Widget, *WidgetBase, error)
- func (wb *WidgetBase) PointToRelPos(pt image.Point) image.Point
- func (wb *WidgetBase) PopBounds()
- func (wb *WidgetBase) PosInScBBox(pos image.Point) bool
- func (wb *WidgetBase) Position()
- func (wb *WidgetBase) PositionChildren()
- func (wb *WidgetBase) PositionParts()
- func (wb *WidgetBase) PositionWidget()
- func (wb *WidgetBase) PositionWithinAllocMainX(pos mat32.Vec2, parJustify, parAlign styles.Aligns)
- func (wb *WidgetBase) PositionWithinAllocMainY(pos mat32.Vec2, parJustify, parAlign styles.Aligns)
- func (wb *WidgetBase) PushBounds() bool
- func (wb *WidgetBase) Render()
- func (wb *WidgetBase) RenderBoxImpl(pos mat32.Vec2, sz mat32.Vec2, bs styles.Border)
- func (wb *WidgetBase) RenderChildren()
- func (wb *WidgetBase) RenderLock() (*paint.Context, *styles.Style)
- func (wb *WidgetBase) RenderParts()
- func (wb *WidgetBase) RenderStdBox(st *styles.Style)
- func (wb *WidgetBase) RenderUnlock()
- func (wb *WidgetBase) ResetStyleWidget()
- func (wb *WidgetBase) RunStylers()
- func (wb *WidgetBase) ScenePos()
- func (wb *WidgetBase) ScenePosChildren()
- func (wb *WidgetBase) ScenePosParts()
- func (wb *WidgetBase) ScenePosWidget()
- func (wb *WidgetBase) ScrollToMe() bool
- func (wb *WidgetBase) Send(typ events.Types, orig ...events.Event)
- func (wb *WidgetBase) SendChange(orig ...events.Event)
- func (wb *WidgetBase) SendKeyChord(kc key.Chord, orig ...events.Event)
- func (wb *WidgetBase) SendKeyChordRune(r rune, code key.Codes, mods key.Modifiers, orig ...events.Event)
- func (wb *WidgetBase) SendKeyFun(kf keyfun.Funs, orig ...events.Event)
- func (wb *WidgetBase) SetAbilities(on bool, able ...abilities.Abilities) *WidgetBase
- func (wb *WidgetBase) SetBBoxes()
- func (wb *WidgetBase) SetBBoxesFromAllocs()
- func (t *WidgetBase) SetClass(v string) *WidgetBase
- func (wb *WidgetBase) SetContentPosFromPos()
- func (t *WidgetBase) SetCustomContextMenu(v func(m *Scene)) *WidgetBase
- func (wb *WidgetBase) SetEnabled(enabled bool) *WidgetBase
- func (wb *WidgetBase) SetFocus()
- func (wb *WidgetBase) SetFocusEvent()
- func (wb *WidgetBase) SetNeedsLayout(updt bool)
- func (wb *WidgetBase) SetNeedsRender(updt bool)
- func (wb *WidgetBase) SetPosFromParent()
- func (wb *WidgetBase) SetReadOnly(ro bool) *WidgetBase
- func (wb *WidgetBase) SetScene(sc *Scene)
- func (wb *WidgetBase) SetSelected(sel bool)
- func (wb *WidgetBase) SetState(on bool, state ...states.States) *WidgetBase
- func (wb *WidgetBase) SetStyles()
- func (t *WidgetBase) SetTooltip(v string) *WidgetBase
- func (wb *WidgetBase) ShowContextMenu(e events.Event)
- func (wb *WidgetBase) SizeDown(iter int) bool
- func (wb *WidgetBase) SizeDownChildren(iter int) bool
- func (wb *WidgetBase) SizeDownParts(iter int) bool
- func (wb *WidgetBase) SizeDownWidget(iter int) bool
- func (wb *WidgetBase) SizeFinal()
- func (wb *WidgetBase) SizeFinalChildren()
- func (wb *WidgetBase) SizeFinalParts()
- func (wb *WidgetBase) SizeFinalWidget()
- func (wb *WidgetBase) SizeFromStyle()
- func (wb *WidgetBase) SizeUp()
- func (wb *WidgetBase) SizeUpChildren()
- func (wb *WidgetBase) SizeUpParts()
- func (wb *WidgetBase) SizeUpWidget()
- func (wb *WidgetBase) SpaceFromStyle()
- func (wb *WidgetBase) StartFocus()
- func (wb *WidgetBase) StateIs(state states.States) bool
- func (wb *WidgetBase) Style(s func(s *styles.Style)) *WidgetBase
- func (wb *WidgetBase) StyleFirst(s func(s *styles.Style)) *WidgetBase
- func (wb *WidgetBase) StyleRLock()
- func (wb *WidgetBase) StyleRUnlock()
- func (wb *WidgetBase) StyleSizeUpdate() bool
- func (wb *WidgetBase) Transition(value any, to any, duration time.Duration, ...)
- func (wb *WidgetBase) Update()
- func (wb *WidgetBase) UpdateEndAsync(updt bool)
- func (wb *WidgetBase) UpdateEndAsyncLayout(updt bool)
- func (wb *WidgetBase) UpdateEndAsyncRender(updt bool)
- func (wb *WidgetBase) UpdateEndLayout(updt bool)
- func (wb *WidgetBase) UpdateEndRender(updt bool)
- func (wb *WidgetBase) UpdateStartAsync() bool
- func (wb *WidgetBase) VisibleKidsIter(fun func(i int, kwi Widget, kwb *WidgetBase) bool)
- func (wb *WidgetBase) WalkPreNode(fun func(ki.Ki) bool)
- func (wb *WidgetBase) WidgetKidsIter(fun func(i int, kwi Widget, kwb *WidgetBase) bool)
- func (wb *WidgetBase) WidgetNextVisible() (Widget, *WidgetBase)
- func (wb *WidgetBase) WidgetPrevVisible() (Widget, *WidgetBase)
- func (wb *WidgetBase) WidgetWalkPre(fun func(kwi Widget, kwb *WidgetBase) bool)
- func (wb *WidgetBase) WinBBox() image.Rectangle
- func (wb *WidgetBase) WinPos(x, y float32) image.Point
- type WidgetFlags
- func (i WidgetFlags) BitIndexString() string
- func (i WidgetFlags) Desc() string
- func (i WidgetFlags) HasFlag(f enums.BitFlag) bool
- func (i WidgetFlags) Int64() int64
- func (i WidgetFlags) IsValid() bool
- func (i WidgetFlags) MarshalText() ([]byte, error)
- func (i *WidgetFlags) SetFlag(on bool, f ...enums.BitFlag)
- func (i *WidgetFlags) SetInt64(in int64)
- func (i *WidgetFlags) SetString(s string) error
- func (i *WidgetFlags) SetStringOr(s string) error
- func (i WidgetFlags) String() string
- func (i *WidgetFlags) UnmarshalText(text []byte) error
- func (i WidgetFlags) Values() []enums.Enum
- type WinFlags
- func (i WinFlags) BitIndexString() string
- func (i WinFlags) Desc() string
- func (i WinFlags) HasFlag(f enums.BitFlag) bool
- func (i WinFlags) Int64() int64
- func (i WinFlags) IsValid() bool
- func (i WinFlags) MarshalText() ([]byte, error)
- func (i *WinFlags) SetFlag(on bool, f ...enums.BitFlag)
- func (i *WinFlags) SetInt64(in int64)
- func (i *WinFlags) SetString(s string) error
- func (i *WinFlags) SetStringOr(s string) error
- func (i WinFlags) String() string
- func (i *WinFlags) UnmarshalText(text []byte) error
- func (i WinFlags) Values() []enums.Enum
- type WinGeomPrefs
- type WinGeomPrefsMgr
- func (mgr *WinGeomPrefsMgr) AbortSave()
- func (mgr *WinGeomPrefsMgr) DeleteAll()
- func (mgr *WinGeomPrefsMgr) Init()
- func (mgr *WinGeomPrefsMgr) LockFile() error
- func (mgr *WinGeomPrefsMgr) NeedToReload() bool
- func (mgr *WinGeomPrefsMgr) Open() error
- func (mgr *WinGeomPrefsMgr) Pref(winName string, scrn *goosi.Screen) *RenderWinGeom
- func (mgr *WinGeomPrefsMgr) RecordPref(win *RenderWin)
- func (mgr *WinGeomPrefsMgr) ResetCache()
- func (mgr *WinGeomPrefsMgr) RestoreAll()
- func (mgr *WinGeomPrefsMgr) Save() error
- func (mgr *WinGeomPrefsMgr) SaveCached()
- func (mgr *WinGeomPrefsMgr) SaveLastSave()
- func (mgr *WinGeomPrefsMgr) SettingEnd()
- func (mgr *WinGeomPrefsMgr) SettingStart()
- func (mgr *WinGeomPrefsMgr) UnlockFile()
- func (mgr *WinGeomPrefsMgr) WinName(winName string) string
Constants ¶
const ( // Sprites are stored as arrays of same-sized textures, // allocated by size in Set 2, starting at 32 SpriteStart = goosi.MaxTexturesPerSet * 2 // Full set of sprite textures in set = 2 MaxSpriteTextures = goosi.MaxTexturesPerSet // Allocate 128 layers within each sprite size MaxSpritesPerTexture = 128 )
const ( // Version is the version of this package being used Version = "v2.0.0-dev0.0.28" // GitCommit is the commit just before the latest version commit GitCommit = "0057b380" // VersionDate is the date-time of the latest version commit in UTC (in the format 'YYYY-MM-DD HH:MM', which is the Go format '2006-01-02 15:04') VersionDate = "2023-12-26 23:37" )
const (
DragSpriteName = "__DragSprite__"
)
Variables ¶
var ( // CompleteWaitDuration is the amount of time to wait before // showing the completion menu CompleteWaitDuration time.Duration = 0 // CompleteMaxItems is the max number of items to display in completer popup CompleteMaxItems = 25 )
var ( // DragStartTime is the time to wait before DragStart DragStartTime = 200 * time.Millisecond // DragStartDist is pixel distance that must be moved before DragStart DragStartDist = 20 // SlideStartTime is the time to wait before SlideStart SlideStartTime = 50 * time.Millisecond // SlideStartDist is pixel distance that must be moved before SlideStart SlideStartDist = 4 // LongHoverTime is the time to wait before LongHoverStart event LongHoverTime = 500 * time.Millisecond // LongHoverStopDist is the pixel distance beyond which the LongHoverEnd // event is sent LongHoverStopDist = 5 // LongPressTime is the time to wait before sending a LongPress event LongPressTime = 500 * time.Millisecond // LongPressStopDist is the pixel distance beyond which the LongPressEnd // event is sent LongPressStopDist = 50 )
var ( // LayoutPrefMaxRows is maximum number of rows to use in a grid layout // when computing the preferred size (ScPrefSizing) LayoutPrefMaxRows = 20 // LayoutPrefMaxCols is maximum number of columns to use in a grid layout // when computing the preferred size (ScPrefSizing) LayoutPrefMaxCols = 20 // LayoutFocusNameTimeout is the amount of time between keypresses // to combine characters into name to search for within layout -- starts over // after this delay. LayoutFocusNameTimeout = 500 * time.Millisecond // LayoutFocusNameTabTime is the number of milliseconds since last focus name // event to allow tab to focus on next element with same name. LayoutFocusNameTabTime = 2000 * time.Millisecond // LayoutAutoScrollDelay is amount of time to wait before trying to autoscroll again LayoutAutoScrollDelay = 25 * time.Millisecond // AutoScrollRate determines the rate of auto-scrolling of layouts AutoScrollRate = float32(1.0) // LayoutPageSteps is the number of steps to take in PageUp / Down events // in terms of number of items. LayoutPageSteps = 10 )
var ( // 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 // WinNewCloseTime records last time a new window was opened or another // closed -- used to trigger updating of RenderWin menus on each window. WinNewCloseTime time.Time // RenderWinGlobalMu is a mutex for any global state associated with windows RenderWinGlobalMu sync.Mutex // RenderWinOpenTimer 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. RenderWinOpenTimer time.Time )
var ( // UpdateTrace reports a trace of updates that trigger re-rendering. // Can be set in PrefsDebug from prefs gui UpdateTrace bool // RenderTrace reports a trace of the nodes rendering // (just printfs to stdout). // Can be set in PrefsDebug from prefs gui RenderTrace bool // LayoutTrace reports a trace of all layouts (just // printfs to stdout) // Can be set in PrefsDebug from prefs gui LayoutTrace bool // LayoutTraceDetail provides more detailed info for Layout // about the underlying layout computations LayoutTraceDetail bool // WinEventTrace reports a trace of window events to stdout // can be set in PrefsDebug from prefs gui // excludes mouse move events WinEventTrace = false // WinRenderTrace 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 WinRenderTrace = 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 // FocusTrace reports a trace of focus. // can be set in PrefsDebug from prefs gui FocusTrace = false )
var ( // WinGeomMgr is the manager of window geometry preferences WinGeomMgr = WinGeomPrefsMgr{} // WinGeomTrace logs window geometry saving / loading functions WinGeomTrace = false ErrWinGeomNoLock = errors.New("WinGeom could not lock lock file") )
var AllSettings = ordmap.Make([]ordmap.KeyVal[string, Settings]{ {"Appearance", GeneralSettings}, })
AllSettings is a global ordered map containing all of the user Settings that the user will see in the settings window. It contains the base Goki settings by default and should be modified by other apps to add their app settings.
var AppChooserType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.AppChooser", ShortName: "gi.AppChooser", IDName: "app-chooser", Doc: "AppChooser is an editable chooser element, typically placed at the start\nof the TopAppBar, that provides direct access to all manner of app resources.", Directives: gti.Directives{}, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Resources", >i.Field{Name: "Resources", Type: "goki.dev/fi/uri.Resources", LocalType: "uri.Resources", Doc: "Resources are generators for resources accessible by the AppChooser", Directives: gti.Directives{}, Tag: ""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Chooser", >i.Field{Name: "Chooser", Type: "goki.dev/gi/v2/gi.Chooser", LocalType: "Chooser", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &AppChooser{}, })
AppChooserType is the gti.Type for AppChooser
var BasicBarType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.BasicBar", ShortName: "gi.BasicBar", IDName: "basic-bar", Doc: "BasicBar is just a styled Frame layout for holding buttons\nand other widgets. Use this when the more advanced features\nof the Toolbar are not needed.", Directives: gti.Directives{}, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Frame", >i.Field{Name: "Frame", Type: "goki.dev/gi/v2/gi.Frame", LocalType: "Frame", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &BasicBar{}, })
BasicBarType is the gti.Type for BasicBar
var BodyType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.Body", ShortName: "gi.Body", IDName: "body", Doc: "Body holds the primary content of a Scene", Directives: gti.Directives{ >i.Directive{Tool: "goki", Directive: "no-new", Args: []string{}}, }, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Title", >i.Field{Name: "Title", Type: "string", LocalType: "string", Doc: "title of the Body, also used for window title where relevant", Directives: gti.Directives{}, Tag: ""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Frame", >i.Field{Name: "Frame", Type: "goki.dev/gi/v2/gi.Frame", LocalType: "Frame", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &Body{}, })
BodyType is the gti.Type for Body
var BoxType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.Box", ShortName: "gi.Box", IDName: "box", Doc: "Box is a simple base [Widget] that renders the Std Box model", Directives: gti.Directives{}, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"WidgetBase", >i.Field{Name: "WidgetBase", Type: "goki.dev/gi/v2/gi.WidgetBase", LocalType: "WidgetBase", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &Box{}, })
BoxType is the gti.Type for Box
var ButtonType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.Button", ShortName: "gi.Button", IDName: "button", Doc: "Button is a pressable button with text, an icon, an indicator, a shortcut,\nand/or a menu. The standard behavior is to register a click event with OnClick(...).", Directives: gti.Directives{ >i.Directive{Tool: "goki", Directive: "embedder", Args: []string{}}, }, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Type", >i.Field{Name: "Type", Type: "goki.dev/gi/v2/gi.ButtonTypes", LocalType: "ButtonTypes", Doc: "the type of button", Directives: gti.Directives{}, Tag: ""}}, {"Text", >i.Field{Name: "Text", Type: "string", LocalType: "string", Doc: "label for the button -- if blank then no label is presented", Directives: gti.Directives{}, Tag: "set:\"-\""}}, {"Icon", >i.Field{Name: "Icon", Type: "goki.dev/icons.Icon", LocalType: "icons.Icon", Doc: "optional icon for the button -- different buttons can configure this in different ways relative to the text if both are present", Directives: gti.Directives{}, Tag: "xml:\"icon\" view:\"show-name\""}}, {"Indicator", >i.Field{Name: "Indicator", Type: "goki.dev/icons.Icon", LocalType: "icons.Icon", Doc: "name of the menu indicator icon to present, or blank or 'nil' or 'none' -- shown automatically when there are Menu elements present unless 'none' is set", Directives: gti.Directives{}, Tag: "xml:\"indicator\" view:\"show-name\""}}, {"Shortcut", >i.Field{Name: "Shortcut", Type: "goki.dev/goosi/events/key.Chord", LocalType: "key.Chord", Doc: "optional shortcut keyboard chord to trigger this button,\nactive in window-wide scope.\nAvoid conflict with other shortcuts (a log message will be emitted if so).\nShortcuts are processed after all other processing of keyboard input.\nUse Command for Control / Meta (Mac Command key) per platform.", Directives: gti.Directives{}, Tag: "xml:\"shortcut\""}}, {"Menu", >i.Field{Name: "Menu", Type: "func(m *goki.dev/gi/v2/gi.Scene)", LocalType: "func(m *Scene)", Doc: "If non-nil, a menu constructor function used to build and display a menu whenever the button is clicked.\nThe constructor function should add buttons to the scene that it is passed.", Directives: gti.Directives{}, Tag: ""}}, {"Data", >i.Field{Name: "Data", Type: "any", LocalType: "any", Doc: "optional data that can be used for event handling", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\" view:\"-\""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"WidgetBase", >i.Field{Name: "WidgetBase", Type: "goki.dev/gi/v2/gi.WidgetBase", LocalType: "WidgetBase", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &Button{}, })
ButtonType is the gti.Type for Button
var ChooserType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.Chooser", ShortName: "gi.Chooser", IDName: "chooser", Doc: "Chooser is for selecting items from a dropdown list, with an optional\nedit TextField for typing directly.\nThe items can be of any type, including enum values -- they are converted\nto strings for the display. If the items are of type [icons.Icon], then they\nare displayed using icons instead.", Directives: gti.Directives{}, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Type", >i.Field{Name: "Type", Type: "goki.dev/gi/v2/gi.ChooserTypes", LocalType: "ChooserTypes", Doc: "the type of combo box", Directives: gti.Directives{}, Tag: ""}}, {"Icon", >i.Field{Name: "Icon", Type: "goki.dev/icons.Icon", LocalType: "icons.Icon", Doc: "optional icon", Directives: gti.Directives{}, Tag: "view:\"show-name\""}}, {"Indicator", >i.Field{Name: "Indicator", Type: "goki.dev/icons.Icon", LocalType: "icons.Icon", Doc: "name of the indicator icon to present.", Directives: gti.Directives{}, Tag: "view:\"show-name\""}}, {"Editable", >i.Field{Name: "Editable", Type: "bool", LocalType: "bool", Doc: "provide a text field for editing the value, or just a button for selecting items? Set the editable property", Directives: gti.Directives{}, Tag: ""}}, {"AllowNew", >i.Field{Name: "AllowNew", Type: "bool", LocalType: "bool", Doc: "whether to allow the user to add new items to the combo box through the editable textfield (if Editable is set to true) and a button at the end of the combo box menu", Directives: gti.Directives{}, Tag: ""}}, {"CurLabel", >i.Field{Name: "CurLabel", Type: "string", LocalType: "string", Doc: "CurLabel is the string label for the current value", Directives: gti.Directives{}, Tag: "set:\"-\""}}, {"CurVal", >i.Field{Name: "CurVal", Type: "any", LocalType: "any", Doc: "current selected value", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\" set:\"-\""}}, {"CurIndex", >i.Field{Name: "CurIndex", Type: "int", LocalType: "int", Doc: "current index in list of possible items", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\" set:\"-\""}}, {"Items", >i.Field{Name: "Items", Type: "[]any", LocalType: "[]any", Doc: "items available for selection", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\""}}, {"Icons", >i.Field{Name: "Icons", Type: "[]goki.dev/icons.Icon", LocalType: "[]icons.Icon", Doc: "an optional list of icons displayed for Chooser items;\nthe indices for the icons correspond to those for the items", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\""}}, {"Tooltips", >i.Field{Name: "Tooltips", Type: "[]string", LocalType: "[]string", Doc: "an optional list of tooltips displayed on hover for Chooser items;\nthe indices for the tooltips correspond to those for the items", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\""}}, {"Placeholder", >i.Field{Name: "Placeholder", Type: "string", LocalType: "string", Doc: "if Editable is set to true, text that is displayed in the text field when it is empty, in a lower-contrast manner", Directives: gti.Directives{}, Tag: "set:\"-\""}}, {"MaxLength", >i.Field{Name: "MaxLength", Type: "int", LocalType: "int", Doc: "maximum label length (in runes)", Directives: gti.Directives{}, Tag: ""}}, {"ItemsFunc", >i.Field{Name: "ItemsFunc", Type: "func()", LocalType: "func()", Doc: "ItemsFunc, if non-nil, is a function to call before showing the items\nof the chooser, which is typically used to configure them (eg: if they\nare based on dynamic data)", Directives: gti.Directives{}, Tag: ""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"WidgetBase", >i.Field{Name: "WidgetBase", Type: "goki.dev/gi/v2/gi.WidgetBase", LocalType: "WidgetBase", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &Chooser{}, })
ChooserType is the gti.Type for Chooser
var CursorBlinkTime = 500 * time.Millisecond
CursorBlinkTime is time that cursor blinks on and off -- set to 0 to disable blinking
var CustomConfigStyles func(w Widget)
CustomConfigStyles is the custom, global style configuration function that is called on all widgets to configure their style functions. By default, it is nil. If you set it, you should mostly call AddStyleFunc within it. For reference on how you should structure your CustomStyleFunc, you should look at https://goki.dev/docs/gi/styling.
var DefaultPaths = FavPaths{ {icons.Home, "home", "~"}, {icons.DesktopMac, "Desktop", "~/Desktop"}, {icons.LabProfile, "Documents", "~/Documents"}, {icons.Download, "Downloads", "~/Downloads"}, {icons.Computer, "root", "/"}, }
DefaultPaths are default favorite paths
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 FocusRenderWins []string
FocusRenderWins 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 FrameType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.Frame", ShortName: "gi.Frame", IDName: "frame", Doc: "Frame is a Layout that renders a background according to the\nbackground-color style setting, and optional striping for grid layouts", Directives: gti.Directives{}, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Stripes", >i.Field{Name: "Stripes", Type: "goki.dev/gi/v2/gi.Stripes", LocalType: "Stripes", Doc: "options for striped backgrounds -- rendered as darker bands relative to background color", Directives: gti.Directives{}, Tag: ""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Layout", >i.Field{Name: "Layout", Type: "goki.dev/gi/v2/gi.Layout", LocalType: "Layout", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &Frame{}, })
FrameType is the gti.Type for Frame
var GeneralSettings = &GeneralSettingsData{}
GeneralSettings are the currently active global Goki general settings.
var HandleType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.Handle", ShortName: "gi.Handle", IDName: "handle", Doc: "Handle represents a draggable handle that can be\nused to control the size of an element.", Directives: gti.Directives{}, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Dim", >i.Field{Name: "Dim", Type: "goki.dev/mat32/v2.Dims", LocalType: "mat32.Dims", Doc: "dimension along which the handle slides (opposite of the dimension it is longest on)", Directives: gti.Directives{}, Tag: ""}}, {"Min", >i.Field{Name: "Min", Type: "float32", LocalType: "float32", Doc: "Min is the minimum value that the handle can go to\n(typically the lower bound of the dialog/splits)", Directives: gti.Directives{}, Tag: ""}}, {"Max", >i.Field{Name: "Max", Type: "float32", LocalType: "float32", Doc: "Max is the maximum value that the handle can go to\n(typically the upper bound of the dialog/splits)", Directives: gti.Directives{}, Tag: ""}}, {"Pos", >i.Field{Name: "Pos", Type: "float32", LocalType: "float32", Doc: "Pos is the current position of the handle on the\nscale of [Handle.Min] to [Handle.Max]", Directives: gti.Directives{}, Tag: ""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Box", >i.Field{Name: "Box", Type: "goki.dev/gi/v2/gi.Box", LocalType: "Box", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &Handle{}, })
HandleType is the gti.Type for Handle
var IconType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.Icon", ShortName: "gi.Icon", IDName: "icon", Doc: "Icon contains a svg.SVG element.\nThe rendered version is cached for a given size.", Directives: gti.Directives{}, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"IconName", >i.Field{Name: "IconName", Type: "goki.dev/icons.Icon", LocalType: "icons.Icon", Doc: "icon name that has been set.", Directives: gti.Directives{}, Tag: "set:\"-\""}}, {"Filename", >i.Field{Name: "Filename", Type: "string", LocalType: "string", Doc: "file name for the loaded icon, if loaded", Directives: gti.Directives{}, Tag: "set:\"-\""}}, {"SVG", >i.Field{Name: "SVG", Type: "goki.dev/svg.SVG", LocalType: "svg.SVG", Doc: "SVG drawing", Directives: gti.Directives{}, Tag: "set:\"-\""}}, {"RendSize", >i.Field{Name: "RendSize", Type: "image.Point", LocalType: "image.Point", Doc: "RendSize is the last rendered size of the Icon SVG.\nif the SVG.Name == IconName and this size is the same\nthen the current SVG image is used.", Directives: gti.Directives{}, Tag: "set:\"-\""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"WidgetBase", >i.Field{Name: "WidgetBase", Type: "goki.dev/gi/v2/gi.WidgetBase", LocalType: "WidgetBase", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &Icon{}, })
IconType is the gti.Type for Icon
var ImageType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.Image", ShortName: "gi.Image", IDName: "image", Doc: "Image is a Widget that renders a static bitmap image.\nSee [Styles.ObjectFits] for how to control the image rendering within\nthe allocated size. The minimum requested size is the pixel size in\nDp units (1/160th of an inch).", Directives: gti.Directives{}, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Filename", >i.Field{Name: "Filename", Type: "goki.dev/gi/v2/gi.FileName", LocalType: "FileName", Doc: "file name of image loaded -- set by OpenImage", Directives: gti.Directives{}, Tag: "set:\"-\""}}, {"Pixels", >i.Field{Name: "Pixels", Type: "*image.RGBA", LocalType: "*image.RGBA", Doc: "the bitmap image", Directives: gti.Directives{}, Tag: "copy:\"-\" view:\"-\" xml:\"-\" json:\"-\" set:\"-\""}}, {"PrevPixels", >i.Field{Name: "PrevPixels", Type: "image.Image", LocalType: "image.Image", Doc: "cached last rendered image", Directives: gti.Directives{}, Tag: "copy:\"-\" xml:\"-\" json:\"-\" set:\"-\""}}, {"PrevObjectFit", >i.Field{Name: "PrevObjectFit", Type: "goki.dev/girl/styles.ObjectFits", LocalType: "styles.ObjectFits", Doc: "cached [styles.Style.ObjectFit] of the last rendered image", Directives: gti.Directives{}, Tag: "copy:\"-\" xml:\"-\" json:\"-\" set:\"-\""}}, {"PrevSize", >i.Field{Name: "PrevSize", Type: "goki.dev/mat32/v2.Vec2", LocalType: "mat32.Vec2", Doc: "cached allocated size for the last rendered image", Directives: gti.Directives{}, Tag: "copy:\"-\" xml:\"-\" json:\"-\" set:\"-\""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"WidgetBase", >i.Field{Name: "WidgetBase", Type: "goki.dev/gi/v2/gi.WidgetBase", LocalType: "WidgetBase", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &Image{}, })
ImageType is the gti.Type for Image
var LabelType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.Label", ShortName: "gi.Label", IDName: "label", Doc: "Label is a widget for rendering text labels -- supports full widget model\nincluding box rendering, and full HTML styling, including links -- LinkSig\nemits link with data of URL -- opens default browser if nobody receiving\nsignal. The default white-space option is 'pre' -- set to 'normal' or\nother options to get word-wrapping etc.", Directives: gti.Directives{ >i.Directive{Tool: "goki", Directive: "embedder", Args: []string{}}, }, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Text", >i.Field{Name: "Text", Type: "string", LocalType: "string", Doc: "label to display", Directives: gti.Directives{}, Tag: ""}}, {"Type", >i.Field{Name: "Type", Type: "goki.dev/gi/v2/gi.LabelTypes", LocalType: "LabelTypes", Doc: "the type of label", Directives: gti.Directives{}, Tag: ""}}, {"TextRender", >i.Field{Name: "TextRender", Type: "goki.dev/girl/paint.Text", LocalType: "paint.Text", Doc: "render data for text label", Directives: gti.Directives{}, Tag: "copy:\"-\" xml:\"-\" json:\"-\" set:\"-\""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"WidgetBase", >i.Field{Name: "WidgetBase", Type: "goki.dev/gi/v2/gi.WidgetBase", LocalType: "WidgetBase", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &Label{}, })
LabelType is the gti.Type for Label
var LabeledTextFieldType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.LabeledTextField", ShortName: "gi.LabeledTextField", IDName: "labeled-text-field", Doc: "LabeledTextField is a [Label] with optional associated label,\nhint, and error text.", Directives: gti.Directives{}, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Label", >i.Field{Name: "Label", Type: "string", LocalType: "string", Doc: "Label is the label for the text field", Directives: gti.Directives{}, Tag: ""}}, {"HintText", >i.Field{Name: "HintText", Type: "string", LocalType: "string", Doc: "HintText is the hint text for the text field", Directives: gti.Directives{}, Tag: ""}}, {"ErrorText", >i.Field{Name: "ErrorText", Type: "string", LocalType: "string", Doc: "ErrorText is the error text for the text field.\nIf it is specified, it will be shown instead of\n[LabeledTextField.HintText].", Directives: gti.Directives{}, Tag: ""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"TextField", >i.Field{Name: "TextField", Type: "goki.dev/gi/v2/gi.TextField", LocalType: "TextField", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &LabeledTextField{}, })
LabeledTextFieldType is the gti.Type for LabeledTextField
var LayoutLastAutoScroll time.Time
var LayoutType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.Layout", ShortName: "gi.Layout", IDName: "layout", Doc: "Layout is the primary node type responsible for organizing the sizes\nand positions of child widgets. It does not render, only organize,\nso properties like background color will have no effect.\nAll arbitrary collections of widgets should generally be contained\nwithin a layout -- otherwise the parent widget must take over\nresponsibility for positioning.\nLayouts can automatically add scrollbars depending on the Overflow\nlayout style.\nFor a Grid layout, the 'columns' property should generally be set\nto the desired number of columns, from which the number of rows\nis computed -- otherwise it uses the square root of number of\nelements.", Directives: gti.Directives{}, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"StackTop", >i.Field{Name: "StackTop", Type: "int", LocalType: "int", Doc: "for Stacked layout, index of node to use as the top of the stack.\nOnly the node at this index is rendered -- if not a valid index, nothing is rendered.", Directives: gti.Directives{}, Tag: ""}}, {"LayImpl", >i.Field{Name: "LayImpl", Type: "goki.dev/gi/v2/gi.LayImplState", LocalType: "LayImplState", Doc: "LayImpl contains implementational state info for doing layout", Directives: gti.Directives{}, Tag: "edit:\"-\" copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"HasScroll", >i.Field{Name: "HasScroll", Type: "[2]bool", LocalType: "[2]bool", Doc: "whether scrollbar is used for given dim", Directives: gti.Directives{}, Tag: "edit:\"-\" copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"Scrolls", >i.Field{Name: "Scrolls", Type: "[2]*goki.dev/gi/v2/gi.Slider", LocalType: "[2]*Slider", Doc: "scroll bars -- we fully manage them as needed", Directives: gti.Directives{}, Tag: "edit:\"-\" copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"FocusName", >i.Field{Name: "FocusName", Type: "string", LocalType: "string", Doc: "accumulated name to search for when keys are typed", Directives: gti.Directives{}, Tag: "edit:\"-\" copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"FocusNameTime", >i.Field{Name: "FocusNameTime", Type: "time.Time", LocalType: "time.Time", Doc: "time of last focus name event -- for timeout", Directives: gti.Directives{}, Tag: "edit:\"-\" copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"FocusNameLast", >i.Field{Name: "FocusNameLast", Type: "goki.dev/ki/v2.Ki", LocalType: "ki.Ki", Doc: "last element focused on -- used as a starting point if name is the same", Directives: gti.Directives{}, Tag: "edit:\"-\" copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"WidgetBase", >i.Field{Name: "WidgetBase", Type: "goki.dev/gi/v2/gi.WidgetBase", LocalType: "WidgetBase", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &Layout{}, })
LayoutType is the gti.Type for Layout
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 OverrideSettingsColor = false
OverrideSettingsColor is whether to override the color specified in [Prefs.Color] with whatever the developer specifies, typically through colors.SetSchemes. The intended usage is:
gi.OverrideSettingsColor = true colors.SetSchemes(colors.Green)
It is recommended that you do not set this to give the user more control over their experience, but you can if you wish to enforce brand colors.
The user preference color will always be overridden if it is the default value of Google Blue (#4285f4), so a more recommended option would be to set your own custom scheme but not OverrideSettingsColor, giving you brand colors unless your user explicitly states a preference for a specific color.
var PrefsDbg = PrefsDebug{}
PrefsDbg are the overall debugging preferences
var PrefsDet = PrefsDetailed{}
PrefsDet are the overall detailed preferences
var PrefsDetailedFileName = "prefs_det.toml"
PrefsDetailedFileName is the name of the detailed preferences file in GoGi prefs directory
var PrefsFileName = "prefs.toml"
PrefsFileName is the name of the preferences file in GoGi prefs directory
var ProgressBarType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.ProgressBar", ShortName: "gi.ProgressBar", IDName: "progress-bar", Doc: "ProgressBar is a progress bar that fills up bar as progress continues.\nCall Start with a maximum value to work toward, and ProgStep each time\na progress step has been accomplished -- increments the ProgCur by one\nand display is updated every ProgInc such steps.", Directives: gti.Directives{}, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"ProgMax", >i.Field{Name: "ProgMax", Type: "int", LocalType: "int", Doc: "maximum amount of progress to be achieved", Directives: gti.Directives{}, Tag: ""}}, {"ProgInc", >i.Field{Name: "ProgInc", Type: "int", LocalType: "int", Doc: "progress increment when display is updated -- automatically computed from ProgMax at Start but can be overwritten", Directives: gti.Directives{}, Tag: ""}}, {"ProgCur", >i.Field{Name: "ProgCur", Type: "int", LocalType: "int", Doc: "current progress level", Directives: gti.Directives{}, Tag: ""}}, {"ProgMu", >i.Field{Name: "ProgMu", Type: "sync.Mutex", LocalType: "sync.Mutex", Doc: "mutex for updating progress", Directives: gti.Directives{}, Tag: "set:\"-\""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Slider", >i.Field{Name: "Slider", Type: "goki.dev/gi/v2/gi.Slider", LocalType: "Slider", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &ProgressBar{}, })
ProgressBarType is the gti.Type for ProgressBar
var SVGType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.SVG", ShortName: "gi.SVG", IDName: "svg", Doc: "SVG is a Widget that renders an [svg.SVG] object.\nIf not ReadOnly, the user can pan and zoom the display.", Directives: gti.Directives{}, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"SVG", >i.Field{Name: "SVG", Type: "*goki.dev/svg.SVG", LocalType: "*svg.SVG", Doc: "SVG is the SVG object associated with the element.", Directives: gti.Directives{}, Tag: "set:\"-\""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"WidgetBase", >i.Field{Name: "WidgetBase", Type: "goki.dev/gi/v2/gi.WidgetBase", LocalType: "WidgetBase", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{ {"OpenSVG", >i.Method{Name: "OpenSVG", Doc: "OpenSVG opens an XML-formatted SVG file", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"filename", >i.Field{Name: "filename", Type: "goki.dev/gi/v2/gi.FileName", LocalType: "FileName", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"error", >i.Field{Name: "error", Type: "error", LocalType: "error", Doc: "", Directives: gti.Directives{}, Tag: ""}}, })}}, {"SaveSVG", >i.Method{Name: "SaveSVG", Doc: "SaveSVG saves the current SVG to an XML-encoded standard SVG file", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"filename", >i.Field{Name: "filename", Type: "goki.dev/gi/v2/gi.FileName", LocalType: "FileName", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"error", >i.Field{Name: "error", Type: "error", LocalType: "error", Doc: "", Directives: gti.Directives{}, Tag: ""}}, })}}, {"SavePNG", >i.Method{Name: "SavePNG", Doc: "SavePNG saves the current rendered SVG image to an PNG image file", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"filename", >i.Field{Name: "filename", Type: "goki.dev/gi/v2/gi.FileName", LocalType: "FileName", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"error", >i.Field{Name: "error", Type: "error", LocalType: "error", Doc: "", Directives: gti.Directives{}, Tag: ""}}, })}}, }), Instance: &SVG{}, })
SVGType is the gti.Type for SVG
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 SceneShowIters = 2
var SceneType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.Scene", ShortName: "gi.Scene", IDName: "scene", Doc: "Scene contains a Widget tree, rooted in an embedded Frame layout,\nwhich renders into its Pixels image.\nThe Scene is set in a Stage (pointer retained in Scene).\nStage has a StageMgr manager for controlling things like Popups\n(Menus and Dialogs, etc).\n\nEach Scene and Widget tree contains state specific to its particular usage\nwithin a given Stage and overall rendering context, representing the unit\nof rendering in the GoGi framework.", Directives: gti.Directives{ >i.Directive{Tool: "goki", Directive: "no-new", Args: []string{}}, >i.Directive{Tool: "goki", Directive: "embedder", Args: []string{}}, }, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"App", >i.Field{Name: "App", Type: "*goki.dev/gi/v2/gi.App", LocalType: "*App", Doc: "App is the pointer to the application to which this scene belongs.\nThe first Main Window Scene must set this, and others will automatically\ngrab from there.", Directives: gti.Directives{}, Tag: ""}}, {"Bars", >i.Field{Name: "Bars", Type: "goki.dev/girl/styles.Sides", LocalType: "styles.Sides[BarFuncs]", Doc: "Bars contains functions for constructing the control bars for this Scene,\nattached to different sides of a Scene (e.g., TopAppBar at Top,\nNavBar at Bottom, etc). Functions are called in forward order\nso first added are called first.", Directives: gti.Directives{}, Tag: ""}}, {"BarsInherit", >i.Field{Name: "BarsInherit", Type: "goki.dev/girl/styles.Sides", LocalType: "styles.Sides[bool]", Doc: "BarsInherit determines which of the Bars side functions are inherited\nfrom the context widget, for FullWindow Dialogs", Directives: gti.Directives{}, Tag: ""}}, {"AppBars", >i.Field{Name: "AppBars", Type: "goki.dev/gi/v2/gi.ToolbarFuncs", LocalType: "ToolbarFuncs", Doc: "AppBars contains functions for configuring a top-level App toolbar,\n(e.g., TopAppBar) for elements contained within this Scene,\nthat should be represented in any app-level toolbar constructed\nfor this Scene.", Directives: gti.Directives{}, Tag: ""}}, {"Body", >i.Field{Name: "Body", Type: "*goki.dev/gi/v2/gi.Body", LocalType: "*Body", Doc: "Body provides the main contents of scenes that use control Bars\nto allow the main window contents to be specified separately\nfrom that dynamic control content. When constructing scenes using\na Body, you can operate directly on the [Body], which has wrappers\nfor most major Scene functions.", Directives: gti.Directives{}, Tag: ""}}, {"Data", >i.Field{Name: "Data", Type: "any", LocalType: "any", Doc: "Data is the optional data value being represented by this scene.\nUsed e.g., for recycling views of a given item instead of creating new one.", Directives: gti.Directives{}, Tag: ""}}, {"SceneGeom", >i.Field{Name: "SceneGeom", Type: "goki.dev/mat32/v2.Geom2DInt", LocalType: "mat32.Geom2DInt", Doc: "Size and position relative to overall rendering context.", Directives: gti.Directives{}, Tag: "edit:\"-\" set:\"-\""}}, {"PaintContext", >i.Field{Name: "PaintContext", Type: "goki.dev/girl/paint.Context", LocalType: "paint.Context", Doc: "paint context for rendering", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" view:\"-\" set:\"-\""}}, {"Pixels", >i.Field{Name: "Pixels", Type: "*image.RGBA", LocalType: "*image.RGBA", Doc: "live pixels that we render into", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" view:\"-\" set:\"-\""}}, {"Background", >i.Field{Name: "Background", Type: "image.Image", LocalType: "image.Image", Doc: "Background for filling scene.\nDefaults to nil so that popups can have rounded corners.", Directives: gti.Directives{}, Tag: ""}}, {"EventMgr", >i.Field{Name: "EventMgr", Type: "goki.dev/gi/v2/gi.EventMgr", LocalType: "EventMgr", Doc: "event manager for this scene", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"Stage", >i.Field{Name: "Stage", Type: "*goki.dev/gi/v2/gi.Stage", LocalType: "*Stage", Doc: "current stage in which this Scene is set", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"RenderBBoxHue", >i.Field{Name: "RenderBBoxHue", Type: "float32", LocalType: "float32", Doc: "RenderBBoxHue is current hue for rendering bounding box in ScRenderBBoxes mode", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" view:\"-\" set:\"-\""}}, {"SelectedWidget", >i.Field{Name: "SelectedWidget", Type: "goki.dev/gi/v2/gi.Widget", LocalType: "Widget", Doc: "the currently selected widget through the inspect editor selection mode", Directives: gti.Directives{}, Tag: ""}}, {"SelectedWidgetChan", >i.Field{Name: "SelectedWidgetChan", Type: "chan goki.dev/gi/v2/gi.Widget", LocalType: "chan Widget", Doc: "the channel on which the selected widget through the inspect editor\nselection mode is transmitted to the inspect editor after the user is done selecting", Directives: gti.Directives{}, Tag: ""}}, {"LastRender", >i.Field{Name: "LastRender", Type: "goki.dev/gi/v2/gi.RenderParams", LocalType: "RenderParams", Doc: "LastRender captures key params from last render.\nIf different then a new ApplyStyleScene is needed.", Directives: gti.Directives{}, Tag: "edit:\"-\" set:\"-\""}}, {"StyleMu", >i.Field{Name: "StyleMu", Type: "sync.RWMutex", LocalType: "sync.RWMutex", Doc: "StyleMu is RW mutex protecting access to Style-related global vars", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" view:\"-\" set:\"-\""}}, {"ShowIter", >i.Field{Name: "ShowIter", Type: "int", LocalType: "int", Doc: "ShowIter counts up at start of showing a Scene\nto trigger Show event and other steps at start of first show", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" view:\"-\" set:\"-\""}}, {"ReRender", >i.Field{Name: "ReRender", Type: "[]goki.dev/gi/v2/gi.Widget", LocalType: "[]Widget", Doc: "ReRender items are re-rendered after the current pass", Directives: gti.Directives{}, Tag: ""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Frame", >i.Field{Name: "Frame", Type: "goki.dev/gi/v2/gi.Frame", LocalType: "Frame", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &Scene{}, })
SceneType is the gti.Type for Scene
var SeparatorType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.Separator", ShortName: "gi.Separator", IDName: "separator", Doc: "Separator draws a vertical or horizontal line", Directives: gti.Directives{}, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Dim", >i.Field{Name: "Dim", Type: "goki.dev/mat32/v2.Dims", LocalType: "mat32.Dims", Doc: "Dim is the dimension the separator goes along (X means it goes longer horizontally, etc)", Directives: gti.Directives{}, Tag: ""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Box", >i.Field{Name: "Box", Type: "goki.dev/gi/v2/gi.Box", LocalType: "Box", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &Separator{}, })
SeparatorType is the gti.Type for Separator
var SliderType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.Slider", ShortName: "gi.Slider", IDName: "slider", Doc: "Slider is a slideable widget that provides slider functionality for two Types:\nSlider type provides a movable thumb that represents Value as the center of thumb\nPos position, with room reserved at ends for 1/2 of the thumb size.\nScrollbar has a VisiblePct factor that specifies the percent of the content\ncurrently visible, which determines the size of the thumb, and thus the range of motion\nremaining for the thumb Value (VisiblePct = 1 means thumb is full size, and no remaining\nrange of motion).\nThe Content size (inside the margin and padding) determines the outer bounds of\nthe rendered area.", Directives: gti.Directives{ >i.Directive{Tool: "goki", Directive: "embedder", Args: []string{}}, }, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Type", >i.Field{Name: "Type", Type: "goki.dev/gi/v2/gi.SliderTypes", LocalType: "SliderTypes", Doc: "the type of the slider, which determines the visual and functional properties", Directives: gti.Directives{}, Tag: "set:\"-\""}}, {"Value", >i.Field{Name: "Value", Type: "float32", LocalType: "float32", Doc: "Current value, represented by the position of the thumb.", Directives: gti.Directives{}, Tag: "set:\"-\""}}, {"Dim", >i.Field{Name: "Dim", Type: "goki.dev/mat32/v2.Dims", LocalType: "mat32.Dims", Doc: "dimension along which the slider slides", Directives: gti.Directives{}, Tag: ""}}, {"Min", >i.Field{Name: "Min", Type: "float32", LocalType: "float32", Doc: "minimum value in range", Directives: gti.Directives{}, Tag: ""}}, {"Max", >i.Field{Name: "Max", Type: "float32", LocalType: "float32", Doc: "maximum value in range", Directives: gti.Directives{}, Tag: ""}}, {"Step", >i.Field{Name: "Step", Type: "float32", LocalType: "float32", Doc: "smallest step size to increment", Directives: gti.Directives{}, Tag: ""}}, {"PageStep", >i.Field{Name: "PageStep", Type: "float32", LocalType: "float32", Doc: "larger PageUp / Dn step size", Directives: gti.Directives{}, Tag: ""}}, {"VisiblePct", >i.Field{Name: "VisiblePct", Type: "float32", LocalType: "float32", Doc: "For Scrollbar type only: proportion (1 max) of the full range of scrolled data\nthat is currently visible. This determines the thumb size and range of motion:\nif 1, full slider is the thumb and no motion is possible.", Directives: gti.Directives{}, Tag: "set:\"-\""}}, {"ThumbSize", >i.Field{Name: "ThumbSize", Type: "goki.dev/mat32/v2.Vec2", LocalType: "mat32.Vec2", Doc: "Size of the thumb as a proportion of the slider thickness, which is\nContent size (inside the padding). This is for actual X,Y dimensions,\nso must be sensitive to Dim dimension alignment.", Directives: gti.Directives{}, Tag: ""}}, {"TrackSize", >i.Field{Name: "TrackSize", Type: "float32", LocalType: "float32", Doc: "TrackSize is the proportion of slider thickness for the visible track\nfor the Slider type. It is often thinner than the thumb, achieved by\nvalues < 1 (.5 default)", Directives: gti.Directives{}, Tag: ""}}, {"Icon", >i.Field{Name: "Icon", Type: "goki.dev/icons.Icon", LocalType: "icons.Icon", Doc: "optional icon for the dragging knob", Directives: gti.Directives{}, Tag: "view:\"show-name\""}}, {"InputThreshold", >i.Field{Name: "InputThreshold", Type: "float32", LocalType: "float32", Doc: "threshold for amount of change in scroll value before emitting an input event", Directives: gti.Directives{}, Tag: ""}}, {"Snap", >i.Field{Name: "Snap", Type: "bool", LocalType: "bool", Doc: "whether to snap the values to Step size increments", Directives: gti.Directives{}, Tag: ""}}, {"Prec", >i.Field{Name: "Prec", Type: "int", LocalType: "int", Doc: "specifies the precision of decimal places (total, not after the decimal point)\nto use in representing the number. This helps to truncate small weird floating\npoint values in the nether regions.", Directives: gti.Directives{}, Tag: ""}}, {"ValueColor", >i.Field{Name: "ValueColor", Type: "image.Image", LocalType: "image.Image", Doc: "The background color that is used for styling the selected value section of the slider.\nIt should be set in the StyleFuncs, just like the main style object is.\nIf it is set to transparent, no value is rendered, so the value section of the slider\njust looks like the rest of the slider.", Directives: gti.Directives{}, Tag: ""}}, {"ThumbColor", >i.Field{Name: "ThumbColor", Type: "image.Image", LocalType: "image.Image", Doc: "The background color that is used for styling the thumb (handle) of the slider.\nIt should be set in the StyleFuncs, just like the main style object is.\nIf it is set to transparent, no thumb is rendered, so the thumb section of the slider\njust looks like the rest of the slider.", Directives: gti.Directives{}, Tag: ""}}, {"StayInView", >i.Field{Name: "StayInView", Type: "bool", LocalType: "bool", Doc: "If true, keep the slider (typically a Scrollbar) within the parent Scene\nbounding box, if the parent is in view. This is the default behavior\nfor Layout scrollbars, and setting this flag replicates that behavior\nin other scrollbars.", Directives: gti.Directives{}, Tag: ""}}, {"Pos", >i.Field{Name: "Pos", Type: "float32", LocalType: "float32", Doc: "logical position of the slider relative to Size", Directives: gti.Directives{}, Tag: "edit:\"-\" set:\"-\""}}, {"LastValue", >i.Field{Name: "LastValue", Type: "float32", LocalType: "float32", Doc: "previous Change event emitted value - don't re-emit Change if it is the same", Directives: gti.Directives{}, Tag: "edit:\"-\" copy:\"-\" xml:\"-\" json:\"-\" set:\"-\""}}, {"PrevSlide", >i.Field{Name: "PrevSlide", Type: "float32", LocalType: "float32", Doc: "previous sliding value - for computing the Input change", Directives: gti.Directives{}, Tag: "edit:\"-\" copy:\"-\" xml:\"-\" json:\"-\" set:\"-\""}}, {"Size", >i.Field{Name: "Size", Type: "float32", LocalType: "float32", Doc: "Computed size of the slide box in the relevant dimension\nrange of motion, exclusive of spacing, based on layout allocation.", Directives: gti.Directives{}, Tag: "edit:\"-\" set:\"-\""}}, {"SlideStartPos", >i.Field{Name: "SlideStartPos", Type: "float32", LocalType: "float32", Doc: "underlying drag position of slider -- not subject to snapping", Directives: gti.Directives{}, Tag: "edit:\"-\" set:\"-\""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"WidgetBase", >i.Field{Name: "WidgetBase", Type: "goki.dev/gi/v2/gi.WidgetBase", LocalType: "WidgetBase", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &Slider{}, })
SliderType is the gti.Type for Slider
var ( // SnackbarTimeout is the default timeout for [SnackbarStage]s SnackbarTimeout = 7 * time.Second // todo: put in prefs )
var SpaceType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.Space", ShortName: "gi.Space", IDName: "space", Doc: "Space adds a fixed sized (1 ch x 1 em by default) blank space to a layout.\nSet width / height property to change.", Directives: gti.Directives{}, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"WidgetBase", >i.Field{Name: "WidgetBase", Type: "goki.dev/gi/v2/gi.WidgetBase", LocalType: "WidgetBase", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &Space{}, })
SpaceType is the gti.Type for Space
var SpinnerType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.Spinner", ShortName: "gi.Spinner", IDName: "spinner", Doc: "Spinner combines a TextField with up / down buttons for incrementing /\ndecrementing values -- all configured within the Parts of the widget", Directives: gti.Directives{ >i.Directive{Tool: "goki", Directive: "embedder", Args: []string{}}, }, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Value", >i.Field{Name: "Value", Type: "float32", LocalType: "float32", Doc: "current value", Directives: gti.Directives{}, Tag: "xml:\"value\" set:\"-\""}}, {"HasMin", >i.Field{Name: "HasMin", Type: "bool", LocalType: "bool", Doc: "is there a minimum value to enforce", Directives: gti.Directives{}, Tag: "xml:\"has-min\" set:\"-\""}}, {"Min", >i.Field{Name: "Min", Type: "float32", LocalType: "float32", Doc: "minimum value in range", Directives: gti.Directives{}, Tag: "xml:\"min\" set:\"-\""}}, {"HasMax", >i.Field{Name: "HasMax", Type: "bool", LocalType: "bool", Doc: "is there a maximumvalue to enforce", Directives: gti.Directives{}, Tag: "xml:\"has-max\" set:\"-\""}}, {"Max", >i.Field{Name: "Max", Type: "float32", LocalType: "float32", Doc: "maximum value in range", Directives: gti.Directives{}, Tag: "xml:\"max\" set:\"-\""}}, {"Step", >i.Field{Name: "Step", Type: "float32", LocalType: "float32", Doc: "smallest step size to increment", Directives: gti.Directives{}, Tag: "xml:\"step\""}}, {"PageStep", >i.Field{Name: "PageStep", Type: "float32", LocalType: "float32", Doc: "larger PageUp / Dn step size", Directives: gti.Directives{}, Tag: "xml:\"pagestep\""}}, {"Prec", >i.Field{Name: "Prec", Type: "int", LocalType: "int", Doc: "specifies the precision of decimal places (total, not after the decimal point) to use in representing the number -- this helps to truncate small weird floating point values in the nether regions", Directives: gti.Directives{}, Tag: ""}}, {"Format", >i.Field{Name: "Format", Type: "string", LocalType: "string", Doc: "prop = format -- format string for printing the value -- blank defaults to %g. If decimal based (ends in d, b, c, o, O, q, x, X, or U) then value is converted to decimal prior to printing", Directives: gti.Directives{}, Tag: "xml:\"format\""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"TextField", >i.Field{Name: "TextField", Type: "goki.dev/gi/v2/gi.TextField", LocalType: "TextField", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &Spinner{}, })
SpinnerType is the gti.Type for Spinner
var SplitsType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.Splits", ShortName: "gi.Splits", IDName: "splits", Doc: "Splits allocates a fixed proportion of space to each child, along given\ndimension. It uses the Widget Parts to hold the Handle widgets\nseparately from the children that contain the rest of the scene to be\ndisplayed within each panel.", Directives: gti.Directives{ >i.Directive{Tool: "goki", Directive: "embedder", Args: []string{}}, }, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Dim", >i.Field{Name: "Dim", Type: "goki.dev/mat32/v2.Dims", LocalType: "mat32.Dims", Doc: "dimension along which to split the space", Directives: gti.Directives{}, Tag: ""}}, {"Splits", >i.Field{Name: "Splits", Type: "[]float32", LocalType: "[]float32", Doc: "proportion (0-1 normalized, enforced) of space allocated to each element.\nEnter 0 to collapse a given element", Directives: gti.Directives{}, Tag: "set:\"-\""}}, {"SavedSplits", >i.Field{Name: "SavedSplits", Type: "[]float32", LocalType: "[]float32", Doc: "A saved version of the splits which can be restored.\nFor dynamic collapse / expand operations", Directives: gti.Directives{}, Tag: "set:\"-\""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Layout", >i.Field{Name: "Layout", Type: "goki.dev/gi/v2/gi.Layout", LocalType: "Layout", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &Splits{}, })
SplitsType is the gti.Type for Splits
var StretchType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.Stretch", ShortName: "gi.Stretch", IDName: "stretch", Doc: "Stretch adds an infinitely stretchy element for spacing out layouts\n(max-size = -1) set the width / height property to determine how much it\ntakes relative to other stretchy elements", Directives: gti.Directives{}, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"WidgetBase", >i.Field{Name: "WidgetBase", Type: "goki.dev/gi/v2/gi.WidgetBase", LocalType: "WidgetBase", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &Stretch{}, })
StretchType is the gti.Type for Stretch
var StructViewIfDebug = false
StrucdtViewIfDebug is a debug flag for getting error messages on viewif struct tag directives in the giv.StructView.
var StyleSheetType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.StyleSheet", ShortName: "gi.StyleSheet", IDName: "style-sheet", Doc: "StyleSheet is a Widget node that contains a stylesheet -- property values\ncontained in this sheet can be transformed into ki.Props and set in CSS\nfield of appropriate node", Directives: gti.Directives{}, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Sheet", >i.Field{Name: "Sheet", Type: "*github.com/aymerick/douceur/css.Stylesheet", LocalType: "*css.Stylesheet", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"WidgetBase", >i.Field{Name: "WidgetBase", Type: "goki.dev/gi/v2/gi.WidgetBase", LocalType: "WidgetBase", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &StyleSheet{}, })
StyleSheetType is the gti.Type for StyleSheet
var SwitchType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.Switch", ShortName: "gi.Switch", IDName: "switch", Doc: "Switch is a widget that can toggle between an on and off state.\nIt can be displayed as a switch, checkbox, or radio button.", Directives: gti.Directives{}, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Type", >i.Field{Name: "Type", Type: "goki.dev/gi/v2/gi.SwitchTypes", LocalType: "SwitchTypes", Doc: "the type of switch that this is", Directives: gti.Directives{}, Tag: "set:\"-\""}}, {"Text", >i.Field{Name: "Text", Type: "string", LocalType: "string", Doc: "the label text for the switch", Directives: gti.Directives{}, Tag: ""}}, {"IconOn", >i.Field{Name: "IconOn", Type: "goki.dev/icons.Icon", LocalType: "icons.Icon", Doc: "icon to use for the on, checked state of the switch", Directives: gti.Directives{}, Tag: "view:\"show-name\""}}, {"IconOff", >i.Field{Name: "IconOff", Type: "goki.dev/icons.Icon", LocalType: "icons.Icon", Doc: "icon to use for the off, unchecked state of the switch", Directives: gti.Directives{}, Tag: "view:\"show-name\""}}, {"IconUnk", >i.Field{Name: "IconUnk", Type: "goki.dev/icons.Icon", LocalType: "icons.Icon", Doc: "icon to use for the indeterminate (unknown) state", Directives: gti.Directives{}, Tag: "view:\"show-name\""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"WidgetBase", >i.Field{Name: "WidgetBase", Type: "goki.dev/gi/v2/gi.WidgetBase", LocalType: "WidgetBase", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &Switch{}, })
SwitchType is the gti.Type for Switch
var SwitchesType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.Switches", ShortName: "gi.Switches", IDName: "switches", Doc: "Switches is a widget for containing a set of switches.\nIt can optionally enforce mutual exclusivity (i.e., Radio Buttons).\nThe buttons are all in the Parts of the widget and the Parts layout\ndetermines how they are displayed.", Directives: gti.Directives{ >i.Directive{Tool: "goki", Directive: "embedder", Args: []string{}}, }, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Type", >i.Field{Name: "Type", Type: "goki.dev/gi/v2/gi.SwitchTypes", LocalType: "SwitchTypes", Doc: "the type of switches that will be made", Directives: gti.Directives{}, Tag: ""}}, {"Items", >i.Field{Name: "Items", Type: "[]string", LocalType: "[]string", Doc: "the list of items (switch labels)", Directives: gti.Directives{}, Tag: ""}}, {"Tooltips", >i.Field{Name: "Tooltips", Type: "[]string", LocalType: "[]string", Doc: "an optional list of tooltips displayed on hover for checkbox items; the indices for tooltips correspond to those for items", Directives: gti.Directives{}, Tag: ""}}, {"Mutex", >i.Field{Name: "Mutex", Type: "bool", LocalType: "bool", Doc: "whether to make the items mutually exclusive (checking one turns off all the others)", Directives: gti.Directives{}, Tag: ""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Frame", >i.Field{Name: "Frame", Type: "goki.dev/gi/v2/gi.Frame", LocalType: "Frame", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &Switches{}, })
SwitchesType is the gti.Type for Switches
var TabType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.Tab", ShortName: "gi.Tab", IDName: "tab", Doc: "Tab is a tab button that contains a larger select button\nand a smaller close button. The Indicator icon is used for\nthe close icon.", Directives: gti.Directives{}, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"MaxChars", >i.Field{Name: "MaxChars", Type: "int", LocalType: "int", Doc: "Maximum number of characters to include in tab label.\nElides labels that are longer than that", Directives: gti.Directives{}, Tag: ""}}, {"DeleteButton", >i.Field{Name: "DeleteButton", Type: "bool", LocalType: "bool", Doc: "if true, this tab has a delete button (true by default)", Directives: gti.Directives{}, Tag: ""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Button", >i.Field{Name: "Button", Type: "goki.dev/gi/v2/gi.Button", LocalType: "Button", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &Tab{}, })
TabType is the gti.Type for Tab
var TabsType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.Tabs", ShortName: "gi.Tabs", IDName: "tabs", Doc: "Tabs switches among child widgets via tabs. The selected widget gets\nthe full allocated space avail after the tabs are accounted for. The\nTabs is just a Vertical layout that manages two child widgets: a\nHorizFlow Layout for the tabs (which can flow across multiple rows as\nneeded) and a Stacked Frame that actually contains all the children, and\nprovides scrollbars as needed to any content within. Typically should have\nmax stretch and a set preferred size, so it expands.", Directives: gti.Directives{ >i.Directive{Tool: "goki", Directive: "embedder", Args: []string{}}, }, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"MaxChars", >i.Field{Name: "MaxChars", Type: "int", LocalType: "int", Doc: "Maximum number of characters to include in tab label.\nElides labels that are longer than that", Directives: gti.Directives{}, Tag: ""}}, {"NewTabButton", >i.Field{Name: "NewTabButton", Type: "bool", LocalType: "bool", Doc: "show a new tab button at right of list of tabs", Directives: gti.Directives{}, Tag: ""}}, {"DeleteTabButtons", >i.Field{Name: "DeleteTabButtons", Type: "bool", LocalType: "bool", Doc: "if true, tabs are user-deleteable (false by default)", Directives: gti.Directives{}, Tag: ""}}, {"Mu", >i.Field{Name: "Mu", Type: "sync.Mutex", LocalType: "sync.Mutex", Doc: "mutex protecting updates to tabs.\nTabs can be driven programmatically and via user input so need extra protection", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" view:\"-\" set:\"-\""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Layout", >i.Field{Name: "Layout", Type: "goki.dev/gi/v2/gi.Layout", LocalType: "Layout", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &Tabs{}, })
TabsType is the gti.Type for Tabs
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 TextFieldSpriteName = "gi.TextField.Cursor"
TextFieldSpriteName is the name of the window sprite used for the cursor
var TextFieldType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.TextField", ShortName: "gi.TextField", IDName: "text-field", Doc: "TextField is a widget for editing a line of text", Directives: gti.Directives{ >i.Directive{Tool: "goki", Directive: "embedder", Args: []string{}}, }, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Txt", >i.Field{Name: "Txt", Type: "string", LocalType: "string", Doc: "the last saved value of the text string being edited", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"text\" set:\"-\""}}, {"Placeholder", >i.Field{Name: "Placeholder", Type: "string", LocalType: "string", Doc: "text that is displayed when the field is empty, in a lower-contrast manner", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"placeholder\""}}, {"Complete", >i.Field{Name: "Complete", Type: "*goki.dev/gi/v2/gi.Complete", LocalType: "*Complete", Doc: "functions and data for textfield completion", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\""}}, {"NoEcho", >i.Field{Name: "NoEcho", Type: "bool", LocalType: "bool", Doc: "replace displayed characters with bullets to conceal text", Directives: gti.Directives{}, Tag: ""}}, {"LeadingIcon", >i.Field{Name: "LeadingIcon", Type: "goki.dev/icons.Icon", LocalType: "icons.Icon", Doc: "if specified, a button will be added at the start of the text field with this icon", Directives: gti.Directives{}, Tag: "set:\"-\""}}, {"LeadingIconOnClick", >i.Field{Name: "LeadingIconOnClick", Type: "func(e goki.dev/goosi/events.Event)", LocalType: "func(e events.Event)", Doc: "if LeadingIcon is specified, the function to call when the leading icon is clicked", Directives: gti.Directives{}, Tag: ""}}, {"TrailingIcon", >i.Field{Name: "TrailingIcon", Type: "goki.dev/icons.Icon", LocalType: "icons.Icon", Doc: "if specified, a button will be added at the end of the text field with this icon", Directives: gti.Directives{}, Tag: "set:\"-\""}}, {"TrailingIconOnClick", >i.Field{Name: "TrailingIconOnClick", Type: "func(e goki.dev/goosi/events.Event)", LocalType: "func(e events.Event)", Doc: "if TrailingIcon is specified, the function to call when the trailing icon is clicked", Directives: gti.Directives{}, Tag: ""}}, {"CursorWidth", >i.Field{Name: "CursorWidth", Type: "goki.dev/girl/units.Value", LocalType: "units.Value", Doc: "width of cursor -- set from cursor-width property (inherited)", Directives: gti.Directives{}, Tag: "xml:\"cursor-width\""}}, {"Type", >i.Field{Name: "Type", Type: "goki.dev/gi/v2/gi.TextFieldTypes", LocalType: "TextFieldTypes", Doc: "the type of the text field", Directives: gti.Directives{}, Tag: ""}}, {"PlaceholderColor", >i.Field{Name: "PlaceholderColor", Type: "image/color.RGBA", LocalType: "color.RGBA", Doc: "the color used for the placeholder text; this should be set in Stylers like all other style properties; it is typically a highlighted version of the normal text color", Directives: gti.Directives{}, Tag: ""}}, {"SelectColor", >i.Field{Name: "SelectColor", Type: "image.Image", LocalType: "image.Image", Doc: "the color used for the text selection background color on active text fields; this should be set in Stylers like all other style properties", Directives: gti.Directives{}, Tag: ""}}, {"CursorColor", >i.Field{Name: "CursorColor", Type: "image.Image", LocalType: "image.Image", Doc: "the color used for the text field cursor (caret); this should be set in Stylers like all other style properties", Directives: gti.Directives{}, Tag: ""}}, {"Edited", >i.Field{Name: "Edited", Type: "bool", LocalType: "bool", Doc: "true if the text has been edited relative to the original", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\" set:\"-\""}}, {"EditTxt", >i.Field{Name: "EditTxt", Type: "[]rune", LocalType: "[]rune", Doc: "the live text string being edited, with latest modifications -- encoded as runes", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\" set:\"-\""}}, {"MaxWidthReq", >i.Field{Name: "MaxWidthReq", Type: "int", LocalType: "int", Doc: "maximum width that field will request, in characters, during GetSize process -- if 0 then is 50 -- ensures that large strings don't request super large values -- standard max-width can override", Directives: gti.Directives{}, Tag: ""}}, {"EffPos", >i.Field{Name: "EffPos", Type: "goki.dev/mat32/v2.Vec2", LocalType: "mat32.Vec2", Doc: "effective position with any leading icon space added", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"EffSize", >i.Field{Name: "EffSize", Type: "goki.dev/mat32/v2.Vec2", LocalType: "mat32.Vec2", Doc: "effective size, subtracting any leading and trailing icon space", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"StartPos", >i.Field{Name: "StartPos", Type: "int", LocalType: "int", Doc: "starting display position in the string", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"EndPos", >i.Field{Name: "EndPos", Type: "int", LocalType: "int", Doc: "ending display position in the string", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"CursorPos", >i.Field{Name: "CursorPos", Type: "int", LocalType: "int", Doc: "current cursor position", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"CharWidth", >i.Field{Name: "CharWidth", Type: "int", LocalType: "int", Doc: "approximate number of chars that can be displayed at any time -- computed from font size etc", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"SelectStart", >i.Field{Name: "SelectStart", Type: "int", LocalType: "int", Doc: "starting position of selection in the string", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"SelectEnd", >i.Field{Name: "SelectEnd", Type: "int", LocalType: "int", Doc: "ending position of selection in the string", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"SelectInit", >i.Field{Name: "SelectInit", Type: "int", LocalType: "int", Doc: "initial selection position -- where it started", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"SelectMode", >i.Field{Name: "SelectMode", Type: "bool", LocalType: "bool", Doc: "if true, select text as cursor moves", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\""}}, {"RenderAll", >i.Field{Name: "RenderAll", Type: "goki.dev/girl/paint.Text", LocalType: "paint.Text", Doc: "render version of entire text, for sizing", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"RenderVis", >i.Field{Name: "RenderVis", Type: "goki.dev/girl/paint.Text", LocalType: "paint.Text", Doc: "render version of just visible text", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"FontHeight", >i.Field{Name: "FontHeight", Type: "float32", LocalType: "float32", Doc: "font height, cached during styling", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"BlinkOn", >i.Field{Name: "BlinkOn", Type: "bool", LocalType: "bool", Doc: "oscillates between on and off for blinking", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"CursorMu", >i.Field{Name: "CursorMu", Type: "sync.Mutex", LocalType: "sync.Mutex", Doc: "mutex for updating cursor between blinker and field", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" view:\"-\" set:\"-\""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"WidgetBase", >i.Field{Name: "WidgetBase", Type: "goki.dev/gi/v2/gi.WidgetBase", LocalType: "WidgetBase", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &TextField{}, })
TextFieldType is the gti.Type for TextField
var ToolbarType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.Toolbar", ShortName: "gi.Toolbar", IDName: "toolbar", Doc: "Toolbar is a [Frame] that is useful for holding [Button]s that do things.\nIt automatically moves items that do not fit into an overflow menu, and\nmanages additional items that are always placed onto this overflow menu.\nIn general it should be possible to use a single toolbar + overflow to\nmanage all an app's functionality, in a way that is portable across\nmobile and desktop environments.\nSee [Widget.ConfigToolbar] for the standard toolbar config method for\nany given widget, and [Scene.AppBars] for [ToolbarFuncs] for [Scene]\nelements who should be represented in the main AppBar (e.g., TopAppBar).", Directives: gti.Directives{ >i.Directive{Tool: "goki", Directive: "embedder", Args: []string{}}, }, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"OverflowItems", >i.Field{Name: "OverflowItems", Type: "goki.dev/ki/v2.Slice", LocalType: "ki.Slice", Doc: "items moved from the main toolbar, will be shown in the overflow menu", Directives: gti.Directives{}, Tag: "set:\"-\" json:\"-\" xml:\"-\""}}, {"OverflowMenus", >i.Field{Name: "OverflowMenus", Type: "[]func(m *goki.dev/gi/v2/gi.Scene)", LocalType: "[]func(m *Scene)", Doc: "functions for overflow menu: use AddOverflowMenu to add.\nThese are processed in _reverse_ order (last in, first called)\nso that the default items are added last.", Directives: gti.Directives{}, Tag: "set:\"-\" json:\"-\" xml:\"-\""}}, {"ToolbarFuncs", >i.Field{Name: "ToolbarFuncs", Type: "goki.dev/gi/v2/gi.ToolbarFuncs", LocalType: "ToolbarFuncs", Doc: "ToolbarFuncs contains functions for configuring this toolbar,\ncalled on Config", Directives: gti.Directives{}, Tag: ""}}, {"OverflowButton", >i.Field{Name: "OverflowButton", Type: "*goki.dev/gi/v2/gi.Button", LocalType: "*Button", Doc: "This is the overflow button", Directives: gti.Directives{}, Tag: ""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Frame", >i.Field{Name: "Frame", Type: "goki.dev/gi/v2/gi.Frame", LocalType: "Frame", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{ {"StdOverflowMenu", >i.Method{Name: "StdOverflowMenu", Doc: "StdOverflowMenu adds standard overflow menu items.", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"m", >i.Field{Name: "m", Type: "*goki.dev/gi/v2/gi.Scene", LocalType: "*Scene", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}}, }), Instance: &Toolbar{}, })
ToolbarType is the gti.Type for Toolbar
var WidgetBaseType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/gi.WidgetBase", ShortName: "gi.WidgetBase", IDName: "widget-base", Doc: "WidgetBase is the base type for all Widget Widget elements, which are\nmanaged by a containing Layout, and use all 5 rendering passes. All\nelemental widgets must support the ReadOnly and Selected states in a\nreasonable way (Selected only essential when also ReadOnly), so they can\nfunction appropriately in a chooser (e.g., SliceView or TableView) -- this\nincludes toggling selection on left mouse press.", Directives: gti.Directives{}, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Tooltip", >i.Field{Name: "Tooltip", Type: "string", LocalType: "string", Doc: "text for the tooltip for this widget, which can use HTML formatting", Directives: gti.Directives{}, Tag: ""}}, {"Class", >i.Field{Name: "Class", Type: "string", LocalType: "string", Doc: "Class has user-defined class name(s) used for user-dependent styling or\nother misc functions. Multiple class names can be used to combine\nproperties: use spaces to separate per css standard", Directives: gti.Directives{}, Tag: ""}}, {"Parts", >i.Field{Name: "Parts", Type: "*goki.dev/gi/v2/gi.Layout", LocalType: "*Layout", Doc: "Parts are a separate tree of sub-widgets that implement discrete parts\nof a widget. Positions are relative to the parent widget.\nThese are fully managed by the parent widget", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"Geom", >i.Field{Name: "Geom", Type: "goki.dev/gi/v2/gi.GeomState", LocalType: "GeomState", Doc: "Geom has the full layout geometry for size and position of this Widget", Directives: gti.Directives{}, Tag: "edit:\"-\" copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"OverrideStyle", >i.Field{Name: "OverrideStyle", Type: "bool", LocalType: "bool", Doc: "If true, Override the computed styles and allow directly editing Style", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"Styles", >i.Field{Name: "Styles", Type: "goki.dev/girl/styles.Style", LocalType: "styles.Style", Doc: "Styles are styling settings for this widget.\nThese are set in SetApplyStyle which should be called after any Config\nchange (e.g., as done by the Update method). See Stylers for functions\nthat set all of the styles, ordered from initial base defaults to later\nadded overrides.", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"Stylers", >i.Field{Name: "Stylers", Type: "[]func(s *goki.dev/girl/styles.Style)", LocalType: "[]func(s *styles.Style)", Doc: "Stylers are a slice of functions that are called in sequential\nascending order (so the last added styler is called last and\nthus overrides all other functions) to style the element.\nThese should be set using Style function, which can be called\nby end-user and internal code.", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"OnWidgetAdders", >i.Field{Name: "OnWidgetAdders", Type: "[]func(w goki.dev/gi/v2/gi.Widget)", LocalType: "[]func(w Widget)", Doc: "A slice of functions to call on all widgets that are added as children\nto this widget or its children. These functions are called in sequential\nascending order, so the last added one is called last and thus can\noverride anything set by the other ones. These should be set using\nOnWidgetAdded, which can be called by both end-user and internal code.", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"Listeners", >i.Field{Name: "Listeners", Type: "goki.dev/goosi/events.Listeners", LocalType: "events.Listeners", Doc: "Listeners are event listener functions for processing events on this widget.\ntype specific Listeners are added in OnInit when the widget is initialized.", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"PriorityEvents", >i.Field{Name: "PriorityEvents", Type: "[]goki.dev/goosi/events.Types", LocalType: "[]events.Types", Doc: "PriorityEvents has event type(s) that this widget gets sent first.\nEvents are sent in depth-first order, so this enables outer container\nwidgets to get first access to these events.", Directives: gti.Directives{}, Tag: "set:\"-\""}}, {"CustomContextMenu", >i.Field{Name: "CustomContextMenu", Type: "func(m *goki.dev/gi/v2/gi.Scene)", LocalType: "func(m *Scene)", Doc: "CustomContextMenu is an optional context menu constructor function\ncalled by [Widget.MakeContextMenu]. If it is set, then\nit takes over full control of making the context menu for the\n[events.ContextMenu] event. It can call other standard menu functions\nas needed.", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\""}}, {"Sc", >i.Field{Name: "Sc", Type: "*goki.dev/gi/v2/gi.Scene", LocalType: "*Scene", Doc: "Sc is the overall Scene to which we belong. It is automatically\nby widgets whenever they are added to another widget parent.\nIt is passed to most Config, Layout, and Render functions as\na convenience.", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"StyMu", >i.Field{Name: "StyMu", Type: "sync.RWMutex", LocalType: "sync.RWMutex", Doc: "mutex protecting the Style field", Directives: gti.Directives{}, Tag: "copy:\"-\" view:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, {"BBoxMu", >i.Field{Name: "BBoxMu", Type: "sync.RWMutex", LocalType: "sync.RWMutex", Doc: "mutex protecting the BBox fields", Directives: gti.Directives{}, Tag: "copy:\"-\" view:\"-\" json:\"-\" xml:\"-\" set:\"-\""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Node", >i.Field{Name: "Node", Type: "goki.dev/ki/v2.Node", LocalType: "ki.Node", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{ {"Update", >i.Method{Name: "Update", Doc: "Update calls Config and then ApplyStyle\non every Widget in the tree from me.\nThis should be used after any structural changes\nto currently-displayed widgets.\nIt wraps everything in UpdateStart / UpdateEndRender\nso node will render on next pass.\nCall SetNeedsLayout to also trigger a layout where needed.", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}}, }), Instance: &WidgetBase{}, })
WidgetBaseType is the gti.Type for WidgetBase
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.
Functions ¶
func ActivateExistingDialogWindow ¶
ActivateExistingDialogWindow looks for existing dialog window with given Data. If found brings that to the front, returns true for bool, else false.
func ActivateExistingMainWindow ¶
ActivateExistingMainWindow looks for existing window with given Data. If found brings that to the front, returns true for bool, else false.
func AddToSpellModel ¶
AddToSpellModel trains on additional text - extends model
func AsWidget ¶
func AsWidget(k ki.Ki) (Widget, *WidgetBase)
AsWidget returns the given Ki object as a Widget interface and a WidgetBase.
func ChildByLabelStartsCanFocus ¶
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 CompleteEditText ¶
CompleteEditText is a chance to modify the completion selection before it is inserted
func CompleteText ¶
CompleteText is the function for completing text files
func CurrentWindowAppBar ¶
func CurrentWindowAppBar(tb *Toolbar)
CurrentWindowAppBar calls ConfigToolbar functions registered on the Scene to which the given toolbar belongs.
func DataDir ¶
func DataDir() string
DataDir returns the OS-specific data directory: Mac: ~/Library, Linux: ~/.config, Windows: ~/AppData/Roaming
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 ErrorDialog ¶
ErrorDialog opens a new Dialog displaying the given error in the context of the given widget. An optional title can be provided; if it is not, the title will default to "There was an error". If the given error is nil, no dialog is created.
func ErrorSnackbar ¶
ErrorSnackbar opens a [Snackbar] displaying the given error in the context of the given widget. Optional label text can be provided; if it is not, the label text will default to "Error". If the given error is nil, no snackbar. is created.
func GokiDataDir ¶
func GokiDataDir() string
GokiDataDir returns the Goki data directory: DataDir + "Goki". It ensures that the directory exists first.
func GrabRenderFrom ¶
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 ImageToRGBA ¶
ImageToRGBA returns given image as an image.RGBA (no conversion if it is already)
func Init ¶
func Init()
Init performs the overall initialization of the Goki system by loading settings. It is automatically called when a new window opened, but can be called before then if certain settings 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 LinearTransition ¶
LinearTransition is a simple, linear, 1 to 1 timing function that can be passed to WidgetBase.Transition
func MenuSceneConfigStyles ¶
func MenuSceneConfigStyles(msc *Scene)
MenuSceneConfigStyles configures the default styles for the given pop-up menu frame with the given parent. It should be called on menu frames when they are created.
func MessageDialog ¶
MessageDialog opens a new Dialog displaying the given message in the context of the given widget. Optional title can be provided.
func MessageSnackbar ¶
MessageSnackbar opens a [Snackbar] displaying the given message in the context of the given widget.
func NewSpellModelFromText ¶
func NewSpellModelFromText() error
NewSpellModelFromText builds a NEW spelling model from text
func OpenURL ¶
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 ProgressDefaultInc ¶
func RecycleDialog ¶
RecycleDialog looks for a dialog with the given data. If it finds it, it shows it and returns true. Otherwise, it returns false.
func RunTest ¶
func RunTest(test func())
RunTest runs the given function after calling driver.Main and Init. It should only be used in tests, and it should typically be called in TestMain. For example:
func TestMain(m *testing.M) { gi.RunTest(func() { os.Exit(m.Run()) }) } func TestSomething(t *testing.T) { sc := gi.NewScene() gi.NewLabel(sc).SetText("Something") sc.AssertPixelsOnShow(t, "something") }
func SaveSpellModel ¶
func SaveSpellModel() error
SaveSpellModel saves the spelling model which includes the data and parameters
func SetQuitCleanFunc ¶
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 ¶
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 SetUnitContext ¶
SetUnitContext sets the unit context based on size of scene, element, and parent element (from bbox) and then caches everything out in terms of raw pixel dots for rendering. Zero values for element and parent size are ignored.
func StackAll ¶
func StackAll() []byte
StackAll returns a formatted stack trace of all goroutines. It calls runtime.Stack with a large enough buffer to capture the entire trace.
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 StdAppBarConfig ¶
func StdAppBarConfig(pw Widget)
StdAppBarConfig is the standard impl for a [App.AppBarConfig]. It adds a Back navigation buttons and the AppChooser, followed by the [Widget.ConfigToolbar] for the current FullWindow Scene being viewed, along with StdOverflowMenu items. and calls AddDefaultOverflowMenu to provide default menu items, which will appear below any other OverflowMenu items added.
func StdAppBarStart ¶
func StdAppBarStart(tb *Toolbar)
StdAppBarStart adds standard items to start of an AppBar: StdAppBarBack and [StdAppChooser]
func StdOverflowMenu ¶
func StdOverflowMenu(tb *Toolbar)
StdOverflowMenu adds the standard overflow menu function.
func StringsAddExtras ¶
StringsAddExtras is a generic function for appending a slice to a slice used to add items to menus
func StringsAppendIfUnique ¶
StringsAppendIfUnique append str to strs if not already in slice
func StringsDelete ¶
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 ¶
StringsRemoveExtras is a generic function for removing items of a slice from another slice
func TextFieldBlink ¶
func TextFieldBlink()
TextFieldBlink is function that blinks text field cursor
func ToLabel ¶
ToLabel returns the gui-appropriate label for an item, using the Labeler interface if it is defined, and falling back on laser.ToString converter otherwise -- also contains label impls for basic interface types for which we cannot easily define the Labeler interface
func ToolbarStyles ¶
func ToolbarStyles(ly Layouter)
ToolbarStyles can be applied to any layout (e.g., Frame) to achieve standard toolbar styling.
func Wait ¶
func Wait()
Wait waits for all windows to close -- put this at the end of a main function that opens multiple windows.
func WinNewCloseStamp ¶
func WinNewCloseStamp()
WinNewCloseStamp updates the global WinNewCloseTime timestamp for updating windows menus
Types ¶
type App ¶
type App struct { // Name can be used in relevant window titles and prompts, // and specifies the default application-specific data directory Name string // About sets the 'about' info for the app, which appears as a menu option // in the default app menu. About string // AppBarConfig is the function that configures the AppBar, // typically put in the [Scene.Bars.Top] (i.e., a TopAppBar). // Set to StdAppBarConfig by default, which makes the standard AppBar behavior. // Most apps will define their own version to add App-specific // functionality, and set this accordingly. // If this is nil, then no TopAppBar will be created by default. AppBarConfig func(pw Widget) }
App encapsulates various properties of the overall application, including managing an AppBar and associated elements.
func (*App) Config ¶
func (app *App) Config()
Config performs one-time configuration steps after setting properties on the App.
func (*App) DataDir ¶
DataDir returns the application-specific data directory: goosi.DataDir + [App.Name]. It ensures that the directory exists first. Use this directory to store all app-specific data including preferences. DataDir is: Mac: ~/Library, Linux: ~/.config, Windows: ~/AppData/Roaming
type AppChooser ¶
type AppChooser struct { Chooser // Resources are generators for resources accessible by the AppChooser Resources uri.Resources }
AppChooser is an editable chooser element, typically placed at the start of the TopAppBar, that provides direct access to all manner of app resources.
func NewAppChooser ¶
func NewAppChooser(par ki.Ki, name ...string) *AppChooser
NewAppChooser adds a new AppChooser with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func StdAppBarChooser ¶
func StdAppBarChooser(tb *Toolbar) *AppChooser
StdAppBarChooser adds an AppChooser
func (*AppChooser) CopyFieldsFrom ¶
func (ac *AppChooser) CopyFieldsFrom(frm any)
func (*AppChooser) KiType ¶
func (t *AppChooser) KiType() *gti.Type
KiType returns the *gti.Type of AppChooser
func (*AppChooser) OnAdd ¶
func (ac *AppChooser) OnAdd()
func (*AppChooser) OnInit ¶
func (ac *AppChooser) OnInit()
func (*AppChooser) SetAllowNew ¶
func (t *AppChooser) SetAllowNew(v bool) *AppChooser
SetAllowNew sets the [AppChooser.AllowNew]
func (*AppChooser) SetClass ¶
func (t *AppChooser) SetClass(v string) *AppChooser
SetClass sets the [AppChooser.Class]
func (*AppChooser) SetCustomContextMenu ¶
func (t *AppChooser) SetCustomContextMenu(v func(m *Scene)) *AppChooser
SetCustomContextMenu sets the [AppChooser.CustomContextMenu]
func (*AppChooser) SetEditable ¶
func (t *AppChooser) SetEditable(v bool) *AppChooser
SetEditable sets the [AppChooser.Editable]
func (*AppChooser) SetIcon ¶
func (t *AppChooser) SetIcon(v icons.Icon) *AppChooser
SetIcon sets the [AppChooser.Icon]
func (*AppChooser) SetIcons ¶
func (t *AppChooser) SetIcons(v []icons.Icon) *AppChooser
SetIcons sets the [AppChooser.Icons]
func (*AppChooser) SetIndicator ¶
func (t *AppChooser) SetIndicator(v icons.Icon) *AppChooser
SetIndicator sets the [AppChooser.Indicator]
func (*AppChooser) SetItems ¶
func (t *AppChooser) SetItems(v []any) *AppChooser
SetItems sets the [AppChooser.Items]
func (*AppChooser) SetItemsFunc ¶
func (t *AppChooser) SetItemsFunc(v func()) *AppChooser
SetItemsFunc sets the [AppChooser.ItemsFunc]
func (*AppChooser) SetMaxLength ¶
func (t *AppChooser) SetMaxLength(v int) *AppChooser
SetMaxLength sets the [AppChooser.MaxLength]
func (*AppChooser) SetResources ¶
func (t *AppChooser) SetResources(v uri.Resources) *AppChooser
SetResources sets the [AppChooser.Resources]: Resources are generators for resources accessible by the AppChooser
func (*AppChooser) SetTooltip ¶
func (t *AppChooser) SetTooltip(v string) *AppChooser
SetTooltip sets the [AppChooser.Tooltip]
func (*AppChooser) SetTooltips ¶
func (t *AppChooser) SetTooltips(v []string) *AppChooser
SetTooltips sets the [AppChooser.Tooltips]
func (*AppChooser) SetType ¶
func (t *AppChooser) SetType(v ChooserTypes) *AppChooser
SetType sets the [AppChooser.Type]
type BarFuncs ¶
type BarFuncs []func(pw Widget)
BarFuncs are functions for creating control bars, attached to different sides of a Scene (e.g., TopAppBar at Top, NavBar at Bottom, etc). Functions are called in forward order so first added are called first.
type BasicBar ¶
type BasicBar struct {
Frame
}
BasicBar is just a styled Frame layout for holding buttons and other widgets. Use this when the more advanced features of the Toolbar are not needed.
func NewBasicBar ¶
NewBasicBar adds a new BasicBar with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*BasicBar) SetCustomContextMenu ¶
SetCustomContextMenu sets the [BasicBar.CustomContextMenu]
func (*BasicBar) SetStackTop ¶
SetStackTop sets the [BasicBar.StackTop]
func (*BasicBar) SetStripes ¶
SetStripes sets the [BasicBar.Stripes]
func (*BasicBar) SetTooltip ¶
SetTooltip sets the [BasicBar.Tooltip]
type Body ¶
type Body struct { Frame // title of the Body, also used for window title where relevant Title string }
Body holds the primary content of a Scene
func NewAppBody ¶
NewAppBody returns a new Body with a new App initialized with the main properties.
func NewBody ¶
NewBody creates a new Body that will serve as the content of a Scene (e.g., a Window, Dialog, etc). Body forms the central region of a Scene, and has OverflowAuto scrollbars by default. It will create its own parent Scene at this point, and has wrapper functions to transparently manage everything that the Scene typically manages during configuration, so you can usually avoid having to access the Scene directly.
func (*Body) AddBottomBar ¶
AddBottomBar adds the given function for configuring a control bar at the bottom of the window
func (*Body) AddCancel ¶
AddCancel adds Cancel button to given parent Widget (typically in Bottom Bar function), connecting to Close method and the Esc keychord event. Close sends a Change event to the Scene for listeners there. Should add an OnClick listener to this button to perform additional specific actions needed beyond Close. Name should be passed when there are multiple effective Cancel buttons (rare).
func (*Body) AddLeftBar ¶
AddLeftBar adds the given function for configuring a control bar on the left of the window
func (*Body) AddOk ¶
AddOk adds an OK button to given parent Widget (typically in Bottom Bar function), connecting to Close method the Ctrl+Enter keychord event. Close sends a Change event to the Scene for listeners there. Should add an OnClick listener to this button to perform additional specific actions needed beyond Close. Name should be passed when there are multiple effective OK buttons.
func (*Body) AddOkOnly ¶
AddOkOnly just adds an OK button in the BottomBar for simple popup dialogs that just need that one button
func (*Body) AddRightBar ¶
AddRightBar adds the given function for configuring a control bar on the right of the window
func (*Body) AddTitle ¶
AddTitle adds a Label with given title, and sets the Title text which will be used by the Scene etc.
func (*Body) AddTopBar ¶
AddTopBar adds the given function for configuring a control bar at the top of the window
func (*Body) Close ¶
func (bd *Body) Close()
Close closes the stage associated with this Scene (typically for Dialog)
func (*Body) GetTopAppBar ¶
GetTopAppBar returns the TopAppBar Toolbar if it exists, nil otherwise.
func (*Body) NewDialog ¶
NewDialog returns a new PopupWindow dialog Stage in the context of the given widget, optionally with the given name. See [NewFullDialog] for a full-window dialog.
func (*Body) NewFullDialog ¶
NewFullDialog returns a new FullWindow dialog Stage in the context of the given widget, optionally with the given name. See [NewDialog] for a popup-window dialog.
func (*Body) NewWindow ¶
NewWindow returns a new Window stage with given scene contents. Make further configuration choices using Set* methods, which can be chained directly after the New call. Use an appropriate Run call at the end to start the Stage running.
func (*Body) SetCustomContextMenu ¶
SetCustomContextMenu sets the [Body.CustomContextMenu]
func (*Body) SetStackTop ¶
SetStackTop sets the [Body.StackTop]
func (*Body) SetStripes ¶
SetStripes sets the [Body.Stripes]
func (*Body) SetTitle ¶
SetTitle sets the [Body.Title]: title of the Body, also used for window title where relevant
func (*Body) SetTooltip ¶
SetTooltip sets the [Body.Tooltip]
type Box ¶
type Box struct {
WidgetBase
}
Box is a simple base Widget that renders the Std Box model
func NewBox ¶
NewBox adds a new Box with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*Box) SetCustomContextMenu ¶
SetCustomContextMenu sets the [Box.CustomContextMenu]
type Button ¶
type Button struct { WidgetBase // the type of button Type ButtonTypes // label for the button -- if blank then no label is presented Text string `set:"-"` // optional icon for the button -- different buttons can configure this in different ways relative to the text if both are present Icon icons.Icon `xml:"icon" view:"show-name"` // name of the menu indicator icon to present, or blank or 'nil' or 'none' -- shown automatically when there are Menu elements present unless 'none' is set Indicator icons.Icon `xml:"indicator" view:"show-name"` // optional shortcut keyboard chord to trigger this button, // active in window-wide scope. // Avoid conflict with other shortcuts (a log message will be emitted if so). // Shortcuts are processed after all other processing of keyboard input. // Use Command for Control / Meta (Mac Command key) per platform. Shortcut key.Chord `xml:"shortcut"` // If non-nil, a menu constructor function used to build and display a menu whenever the button is clicked. // The constructor function should add buttons to the scene that it is passed. Menu func(m *Scene) // optional data that can be used for event handling Data any `json:"-" xml:"-" view:"-"` }
Button is a pressable button with text, an icon, an indicator, a shortcut, and/or a menu. The standard behavior is to register a click event with OnClick(...).
func AsButton ¶
func AsButton(k ki.Ki) *Button
AsButton returns the given value as a value of type Button if the type of the given value embeds Button, or nil otherwise
func NewButton ¶
NewButton adds a new Button with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*Button) AsButton ¶
AsButton satisfies the ButtonEmbedder interface
func (*Button) ConfigParts ¶
func (bt *Button) ConfigParts()
func (*Button) ConfigPartsAddIndicator ¶
ConfigPartsAddIndicator adds a menu indicator if the Indicator field is set to an icon; if defOn is true, an indicator is added even if the Indicator field is unset (as long as it is not explicitly set to icons.None); 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 (*Button) ConfigPartsAddShortcut ¶
ConfigPartsAddShortcut adds a menu shortcut, with a stretch space -- only called when needed
func (*Button) ConfigPartsIconLabel ¶
func (bt *Button) ConfigPartsIconLabel(config *ki.Config, icnm icons.Icon, 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 (*Button) ConfigPartsIndicator ¶
func (*Button) ConfigPartsSetIconLabel ¶
ConfigPartsSetIconLabel sets the icon and text values in parts, and get part style props, using given props if not set in object props
func (*Button) ConfigPartsShortcut ¶
ConfigPartsShortcut sets the shortcut
func (*Button) ConfigWidget ¶
func (bt *Button) ConfigWidget()
func (*Button) CopyFieldsFrom ¶
func (*Button) HandleClickDismissMenu ¶
func (bt *Button) HandleClickDismissMenu()
func (*Button) HandleClickMenu ¶
func (bt *Button) HandleClickMenu()
func (*Button) HandleEvents ¶
func (bt *Button) HandleEvents()
func (*Button) HandleLongHoverTooltip ¶
func (bt *Button) HandleLongHoverTooltip()
func (*Button) HasMenu ¶
HasMenu returns true if the button has a menu that pops up when it is clicked (not that it is in a menu itself; see ButtonMenu)
func (*Button) IconWidget ¶
IconWidget returns the icon widget if present
func (*Button) LabelWidget ¶
LabelWidget returns the label widget if present
func (*Button) OpenMenu ¶
OpenMenu will open any menu associated with this element. Returns true if menu opened, false if not.
func (*Button) RenderButton ¶
func (bt *Button) RenderButton()
func (*Button) SetCustomContextMenu ¶
SetCustomContextMenu sets the [Button.CustomContextMenu]
func (*Button) SetData ¶
SetData sets the [Button.Data]: optional data that can be used for event handling
func (*Button) SetIcon ¶
SetIcon sets the [Button.Icon]: optional icon for the button -- different buttons can configure this in different ways relative to the text if both are present
func (*Button) SetIconUpdate ¶
SetIconUpdate sets the Icon and does a Config and updates the actual icon render, so it will render next time with the updated text value, without flagging any unnecessary layouts. This is used for more efficient large-scale updating in views.
func (*Button) SetIndicator ¶
SetIndicator sets the [Button.Indicator]: name of the menu indicator icon to present, or blank or 'nil' or 'none' -- shown automatically when there are Menu elements present unless 'none' is set
func (*Button) SetKey ¶
SetKey sets the shortcut of the button from the given keyfun.Funs
func (*Button) SetMenu ¶
SetMenu sets the [Button.Menu]: If non-nil, a menu constructor function used to build and display a menu whenever the button is clicked. The constructor function should add buttons to the scene that it is passed.
func (*Button) SetShortcut ¶
SetShortcut sets the [Button.Shortcut]: optional shortcut keyboard chord to trigger this button, active in window-wide scope. Avoid conflict with other shortcuts (a log message will be emitted if so). Shortcuts are processed after all other processing of keyboard input. Use Command for Control / Meta (Mac Command key) per platform.
func (*Button) SetText ¶
SetText sets the [Button.Text]: label for the button -- if blank then no label is presented
func (*Button) SetTextUpdate ¶
SetTextUpdate sets the Label text and does a Config and updates the actual button label render, so it will render next time with the updated text value, without flagging any unnecessary layouts. This is used for more efficient large-scale updating in views.
func (*Button) SetTooltip ¶
SetTooltip sets the [Button.Tooltip]
func (*Button) SetType ¶
func (t *Button) SetType(v ButtonTypes) *Button
SetType sets the [Button.Type]: the type of button
func (*Button) ShortcutTooltip ¶
ShortcutTooltip returns the effective tooltip of the button with any keyboard shortcut included.
func (*Button) ShowContextMenu ¶
type ButtonEmbedder ¶
type ButtonEmbedder interface {
AsButton() *Button
}
ButtonEmbedder is an interface that all types that embed Button satisfy
type ButtonTypes ¶
type ButtonTypes int32 //enums:enum -trimprefix Button
ButtonTypes is an enum containing the different possible types of buttons
const ( // ButtonFilled is a filled button with a // contrasting background color. It should be // used for prominent actions, typically those // that are the final in a sequence. It is equivalent // to Material Design's filled button. ButtonFilled ButtonTypes = iota // ButtonTonal is a filled button, similar // to [ButtonFilled]. It is used for the same purposes, // but it has a lighter background color and less emphasis. // It is equivalent to Material Design's filled tonal button. ButtonTonal // ButtonElevated is an elevated button with // a light background color and a shadow. // It is equivalent to Material Design's elevated button. ButtonElevated // ButtonOutlined is an outlined button that is // used for secondary actions that are still important. // It is equivalent to Material Design's outlined button. ButtonOutlined // ButtonText is a low-importance button with no border, // background color, or shadow when not being interacted with. // It renders primary-colored text, and it renders a background // color and shadow when hovered/focused/active. // It should only be used for low emphasis // actions, and you must ensure it stands out from the // surrounding context sufficiently. It is equivalent // to Material Design's text button, but it can also // contain icons and other things. ButtonText // ButtonAction is a simple button that typically serves // as a simple action among a series of other buttons // (eg: in a toolbar), or as a part of another widget, // like a spinner or snackbar. It has no border, background color, // or shadow when not being interacted with. It inherits the text // color of its parent, and it renders a background when // hovered/focused/active. you must ensure it stands out from the // surrounding context sufficiently. It is equivalent to Material Design's // icon button, but it can also contain text and other things (and frequently does). ButtonAction // ButtonMenu is similar to [ButtonAction], but it is only // for buttons located in popup menus. ButtonMenu )
const ButtonTypesN ButtonTypes = 7
ButtonTypesN is the highest valid value for type ButtonTypes, plus one.
func ButtonTypesValues ¶
func ButtonTypesValues() []ButtonTypes
ButtonTypesValues returns all possible values for the type ButtonTypes.
func (ButtonTypes) Desc ¶
func (i ButtonTypes) Desc() string
Desc returns the description of the ButtonTypes value.
func (ButtonTypes) Int64 ¶
func (i ButtonTypes) Int64() int64
Int64 returns the ButtonTypes value as an int64.
func (ButtonTypes) IsValid ¶
func (i ButtonTypes) IsValid() bool
IsValid returns whether the value is a valid option for type ButtonTypes.
func (ButtonTypes) MarshalText ¶
func (i ButtonTypes) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (*ButtonTypes) SetInt64 ¶
func (i *ButtonTypes) SetInt64(in int64)
SetInt64 sets the ButtonTypes value from an int64.
func (*ButtonTypes) SetString ¶
func (i *ButtonTypes) SetString(s string) error
SetString sets the ButtonTypes value from its string representation, and returns an error if the string is invalid.
func (ButtonTypes) String ¶
func (i ButtonTypes) String() string
String returns the string representation of this ButtonTypes value.
func (*ButtonTypes) UnmarshalText ¶
func (i *ButtonTypes) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (ButtonTypes) Values ¶
func (i ButtonTypes) Values() []enums.Enum
Values returns all possible values for the type ButtonTypes.
type Chooser ¶
type Chooser struct { WidgetBase // the type of combo box Type ChooserTypes // optional icon Icon icons.Icon `view:"show-name"` // name of the indicator icon to present. Indicator icons.Icon `view:"show-name"` // provide a text field for editing the value, or just a button for selecting items? Set the editable property Editable bool // whether to allow the user to add new items to the combo box through the editable textfield (if Editable is set to true) and a button at the end of the combo box menu AllowNew bool // CurLabel is the string label for the current value CurLabel string `set:"-"` // current selected value CurVal any `json:"-" xml:"-" set:"-"` // current index in list of possible items CurIndex int `json:"-" xml:"-" set:"-"` // items available for selection Items []any `json:"-" xml:"-"` // an optional list of icons displayed for Chooser items; // the indices for the icons correspond to those for the items Icons []icons.Icon `json:"-" xml:"-"` // an optional list of tooltips displayed on hover for Chooser items; // the indices for the tooltips correspond to those for the items Tooltips []string `json:"-" xml:"-"` // if Editable is set to true, text that is displayed in the text field when it is empty, in a lower-contrast manner Placeholder string `set:"-"` // maximum label length (in runes) MaxLength int // ItemsFunc, if non-nil, is a function to call before showing the items // of the chooser, which is typically used to configure them (eg: if they // are based on dynamic data) ItemsFunc func() }
Chooser 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 of type icons.Icon, then they are displayed using icons instead.
func NewChooser ¶
NewChooser adds a new Chooser with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*Chooser) CompleteEdit ¶
func (ch *Chooser) CompleteEdit(data any, text string, cursorPos int, completion complete.Completion, seed string) (ed complete.Edit)
CompleteEdit is the complete.EditFunc used for the editable textfield part of the Chooser (if it exists).
func (*Chooser) CompleteMatch ¶
CompleteMatch is the complete.MatchFunc used for the editable textfield part of the Chooser (if it exists).
func (*Chooser) ConfigParts ¶
func (ch *Chooser) ConfigParts()
func (*Chooser) ConfigWidget ¶
func (ch *Chooser) ConfigWidget()
func (*Chooser) CopyFieldsFrom ¶
func (*Chooser) GetCurTextAction ¶
GetCurTextAction is for Editable choosers only: sets the current index (CurIndex) and the corresponding CurVal based on current user-entered Text value, and triggers a Change event
func (*Chooser) HandleChooserTextFieldEvents ¶
func (*Chooser) HandleEvents ¶
func (ch *Chooser) HandleEvents()
func (*Chooser) HandleKeys ¶
func (ch *Chooser) HandleKeys()
func (*Chooser) IconWidget ¶
IconWidget returns the icon widget if present
func (*Chooser) LabelWidget ¶
LabelWidget returns the label widget if present
func (*Chooser) MakeItems ¶
MakeItems makes sure the Items list is made, and if not, or reset is true, creates one with the given capacity
func (*Chooser) MakeItemsMenu ¶
MakeItemsMenu constructs a menu of all the items. It is automatically set as the [Button.Menu] for the Chooser.
func (*Chooser) OpenMenu ¶
OpenMenu will open any menu associated with this element. Returns true if menu opened, false if not.
func (*Chooser) RenderChooser ¶
func (ch *Chooser) RenderChooser()
func (*Chooser) SelectItem ¶
SelectItem selects a given item and updates the display to it
func (*Chooser) SelectItemAction ¶
SelectItemAction selects a given item and updates the display to it and sends a Changed event to indicate that the value has changed.
func (*Chooser) SetAllowNew ¶
SetAllowNew sets the [Chooser.AllowNew]: whether to allow the user to add new items to the combo box through the editable textfield (if Editable is set to true) and a button at the end of the combo box menu
func (*Chooser) 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 (*Chooser) SetCurText ¶
SetCurText is for Editable choosers only: sets the current index (CurIndex) and the corresponding CurVal based on given text string
func (*Chooser) SetCurTextAction ¶
SetCurTextAction is for Editable choosers only: sets the current index (CurIndex) and the corresponding CurVal based on given text string, and triggers a Change event
func (*Chooser) 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 (*Chooser) SetCustomContextMenu ¶
SetCustomContextMenu sets the [Chooser.CustomContextMenu]
func (*Chooser) SetEditable ¶
SetEditable sets the [Chooser.Editable]: provide a text field for editing the value, or just a button for selecting items? Set the editable property
func (*Chooser) SetEnum ¶
SetEnum sets the Items list from given enums.Enum 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 (*Chooser) SetEnums ¶
SetEnums sets the Items list from a list of enums.Enum 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 (*Chooser) SetIconItems ¶
SetIconItems sets the Items list from a list of icons.Icon 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 (*Chooser) SetIconUpdate ¶
SetIconUpdate sets the icon and drives an update, for the already-displayed case.
func (*Chooser) SetIcons ¶
SetIcons sets the [Chooser.Icons]: an optional list of icons displayed for Chooser items; the indices for the icons correspond to those for the items
func (*Chooser) SetIndicator ¶
SetIndicator sets the [Chooser.Indicator]: name of the indicator icon to present.
func (*Chooser) SetItemsFunc ¶
SetItemsFunc sets the [Chooser.ItemsFunc]: ItemsFunc, if non-nil, is a function to call before showing the items of the chooser, which is typically used to configure them (eg: if they are based on dynamic data)
func (*Chooser) SetMaxLength ¶
SetMaxLength sets the [Chooser.MaxLength]: maximum label length (in runes)
func (*Chooser) SetPlaceholder ¶
SetPlaceholder sets the given placeholder text and CurIndex = -1, indicating that nothing has not been selected.
func (*Chooser) SetStrings ¶
SetStrings 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 (*Chooser) 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 (*Chooser) SetTooltip ¶
SetTooltip sets the [Chooser.Tooltip]
func (*Chooser) SetTooltips ¶
SetTooltips sets the [Chooser.Tooltips]: an optional list of tooltips displayed on hover for Chooser items; the indices for the tooltips correspond to those for the items
func (*Chooser) SetType ¶
func (t *Chooser) SetType(v ChooserTypes) *Chooser
SetType sets the [Chooser.Type]: the type of combo box
func (*Chooser) SetTypes ¶
SetTypes sets the Items list from a list of types, e.g., from gti.AllEmbedersOf. 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 (*Chooser) ShowCurVal ¶
ShowCurVal updates the display to present the currently-selected value (CurVal)
type ChooserTypes ¶
type ChooserTypes int32 //enums:enum -trim-prefix Chooser
ChooserTypes is an enum containing the different possible types of combo boxes
const ( // ChooserFilled represents a filled // Chooser with a background color // and a bottom border ChooserFilled ChooserTypes = iota // ChooserOutlined represents an outlined // Chooser with a border on all sides // and no background color ChooserOutlined )
const ChooserTypesN ChooserTypes = 2
ChooserTypesN is the highest valid value for type ChooserTypes, plus one.
func ChooserTypesValues ¶
func ChooserTypesValues() []ChooserTypes
ChooserTypesValues returns all possible values for the type ChooserTypes.
func (ChooserTypes) Desc ¶
func (i ChooserTypes) Desc() string
Desc returns the description of the ChooserTypes value.
func (ChooserTypes) Int64 ¶
func (i ChooserTypes) Int64() int64
Int64 returns the ChooserTypes value as an int64.
func (ChooserTypes) IsValid ¶
func (i ChooserTypes) IsValid() bool
IsValid returns whether the value is a valid option for type ChooserTypes.
func (ChooserTypes) MarshalText ¶
func (i ChooserTypes) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (*ChooserTypes) SetInt64 ¶
func (i *ChooserTypes) SetInt64(in int64)
SetInt64 sets the ChooserTypes value from an int64.
func (*ChooserTypes) SetString ¶
func (i *ChooserTypes) SetString(s string) error
SetString sets the ChooserTypes value from its string representation, and returns an error if the string is invalid.
func (ChooserTypes) String ¶
func (i ChooserTypes) String() string
String returns the string representation of this ChooserTypes value.
func (*ChooserTypes) UnmarshalText ¶
func (i *ChooserTypes) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (ChooserTypes) Values ¶
func (i ChooserTypes) Values() []enums.Enum
Values returns all possible values for the type ChooserTypes.
type Complete ¶
type Complete struct { // function to get the list of possible completions MatchFunc complete.MatchFunc // function to get the text to show for lookup LookupFunc complete.LookupFunc // function to edit text using the selected completion EditFunc complete.EditFunc // the object that implements complete.Func Context any // line number in source that completion is operating on, if relevant SrcLn int // character position in source that completion is operating on SrcCh int // the list of potential completions Completions complete.Completions // current completion seed Seed string // the user's completion selection Completion string // the event listeners for the completer (it sends Select events) Listeners events.Listeners `set:"-" view:"-"` // Stage is the [PopupStage] associated with the [Complete] Stage *Stage DelayTimer *time.Timer `set:"-"` DelayMu sync.Mutex `set:"-"` ShowMu sync.Mutex `set:"-"` }
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. It also holds the [PopupStage] associated with it.
func NewComplete ¶
func NewComplete() *Complete
NewComplete returns a new Complete object. It does not show it; see Complete.Show.
func (*Complete) Abort ¶
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 sends Select event to listeners, indicating that the user has made a selection from the list of possible completions
func (*Complete) GetCompletion ¶
func (c *Complete) GetCompletion(s string) complete.Completion
func (*Complete) IsAboutToShow ¶
IsAboutToShow returns true if the DelayTimer is started for preparing to show a completion. note: don't really need to lock
func (*Complete) OnSelect ¶
OnSelect registers given listener function for Select events on Value. This is the primary notification event for all Complete elements.
func (*Complete) SetCompletion ¶
SetCompletion sets the [Complete.Completion]: the user's completion selection
func (*Complete) SetCompletions ¶
func (t *Complete) SetCompletions(v complete.Completions) *Complete
SetCompletions sets the [Complete.Completions]: the list of potential completions
func (*Complete) SetContext ¶
SetContext sets the [Complete.Context]: the object that implements complete.Func
func (*Complete) SetEditFunc ¶
SetEditFunc sets the [Complete.EditFunc]: function to edit text using the selected completion
func (*Complete) SetLookupFunc ¶
func (t *Complete) SetLookupFunc(v complete.LookupFunc) *Complete
SetLookupFunc sets the [Complete.LookupFunc]: function to get the text to show for lookup
func (*Complete) SetMatchFunc ¶
SetMatchFunc sets the [Complete.MatchFunc]: function to get the list of possible completions
func (*Complete) SetSrcCh ¶
SetSrcCh sets the [Complete.SrcCh]: character position in source that completion is operating on
func (*Complete) SetSrcLn ¶
SetSrcLn sets the [Complete.SrcLn]: line number in source that completion is operating on, if relevant
func (*Complete) SetStage ¶
SetStage sets the [Complete.Stage]: Stage is the [PopupStage] associated with the Complete
type CompleteSignals ¶
type CompleteSignals int32 //enums:enum -trim-prefix Complete
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 )
const CompleteSignalsN CompleteSignals = 2
CompleteSignalsN is the highest valid value for type CompleteSignals, plus one.
func CompleteSignalsValues ¶
func CompleteSignalsValues() []CompleteSignals
CompleteSignalsValues returns all possible values for the type CompleteSignals.
func (CompleteSignals) Desc ¶
func (i CompleteSignals) Desc() string
Desc returns the description of the CompleteSignals value.
func (CompleteSignals) Int64 ¶
func (i CompleteSignals) Int64() int64
Int64 returns the CompleteSignals value as an int64.
func (CompleteSignals) IsValid ¶
func (i CompleteSignals) IsValid() bool
IsValid returns whether the value is a valid option for type CompleteSignals.
func (CompleteSignals) MarshalText ¶
func (i CompleteSignals) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (*CompleteSignals) SetInt64 ¶
func (i *CompleteSignals) SetInt64(in int64)
SetInt64 sets the CompleteSignals value from an int64.
func (*CompleteSignals) SetString ¶
func (i *CompleteSignals) SetString(s string) error
SetString sets the CompleteSignals value from its string representation, and returns an error if the string is invalid.
func (CompleteSignals) String ¶
func (i CompleteSignals) String() string
String returns the string representation of this CompleteSignals value.
func (*CompleteSignals) UnmarshalText ¶
func (i *CompleteSignals) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (CompleteSignals) Values ¶
func (i CompleteSignals) Values() []enums.Enum
Values returns all possible values for the type CompleteSignals.
type Completer ¶
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 any, matchFun complete.MatchFunc, editFun complete.EditFunc) }
Completer interface supports the SetCompleter method for setting completer parameters This is defined e.g., on TextField and textview.Buf
type Densities ¶
type Densities int32 //enums:enum -trimprefix Density
Densities is an enum representing the different density options in user preferences
const DensitiesN Densities = 3
DensitiesN is the highest valid value for type Densities, plus one.
func DensitiesValues ¶
func DensitiesValues() []Densities
DensitiesValues returns all possible values for the type Densities.
func (Densities) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*Densities) SetString ¶
SetString sets the Densities value from its string representation, and returns an error if the string is invalid.
func (*Densities) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type EditorPrefs ¶
type EditorPrefs struct { // size of a tab, in chars -- also determines indent level for space indent TabSize int `xml:"tab-size"` // use spaces for indentation, otherwise tabs SpaceIndent bool `xml:"space-indent"` // wrap lines at word boundaries -- otherwise long lines scroll off the end WordWrap bool `xml:"word-wrap"` // show line numbers LineNos bool `xml:"line-nos"` // use the completion system to suggest options while typing Completion bool `xml:"completion"` // suggest corrections for unknown words while typing SpellCorrect bool `xml:"spell-correct"` // automatically indent lines when enter, tab, }, etc pressed AutoIndent bool `xml:"auto-indent"` // use emacs-style undo, where after a non-undo command, all the current undo actions are added to the undo stack, such that a subsequent undo is actually a redo EmacsUndo bool `xml:"emacs-undo"` // colorize the background according to nesting depth DepthColor bool `xml:"depth-color"` }
EditorPrefs contains editor preferences. It can also be set from ki.Props style properties.
func (*EditorPrefs) Defaults ¶
func (pf *EditorPrefs) Defaults()
Defaults are the defaults for EditorPrefs
type EventMgr ¶
type EventMgr struct { // Scene is the scene that we manage events for Scene *Scene // mutex that protects timer variable updates (e.g., hover AfterFunc's) TimerMu sync.Mutex // stack of widgets with mouse pointer in BBox, and are not Disabled. // Last item in the stack is the deepest nested widget (smallest BBox). MouseInBBox []Widget // stack of hovered widgets: have mouse pointer in BBox and have Hoverable flag Hovers []Widget // the current candidate for a long hover event LongHoverWidget Widget // the position of the mouse at the start of LongHoverTimer LongHoverPos image.Point // the timer for the LongHover event, started with time.AfterFunc LongHoverTimer *time.Timer // the current candidate for a long press event LongPressWidget Widget // the position of the mouse at the start of LongPressTimer LongPressPos image.Point // the timer for the LongPress event, started with time.AfterFunc LongPressTimer *time.Timer // stack of drag-hovered widgets: have mouse pointer in BBox and have Droppable flag DragHovers []Widget // node that was just pressed Press Widget // node receiving mouse dragging events -- for drag-n-drop Drag Widget // node receiving mouse sliding events Slide Widget // node receiving mouse scrolling events Scroll Widget // node receiving keyboard events -- use SetFocus, CurFocus Focus Widget // node to focus on at start when no other focus has been set yet -- use SetStartFocus StartFocus Widget // if StartFocus not set, activate starting focus on first element StartFocusFirst bool // previously-focused widget -- what was in Focus when FocusClear is called PrevFocus Widget // stack of focus within elements FocusWithinStack []Widget // Last Select Mode from most recent Mouse, Keyboard events LastSelMode events.SelectModes // Currently active shortcuts for this window (shortcuts are always window-wide. // Use widget key event processing for more local key functions) Shortcuts Shortcuts // PriorityFocus are widgets with Focus PriorityEvents PriorityFocus []Widget // PriorityOther are widgets with other PriorityEvents types PriorityOther []Widget // source data from DragStart event DragData any }
EventMgr is an event manager that handles incoming events for a Scene. It creates all the derived event types (Hover, Sliding, Dragging) and Focus management for keyboard events.
func (*EventMgr) ActivateStartFocus ¶
ActivateStartFocus activates start focus if there is no current focus and StartFocus is set -- returns true if activated
func (*EventMgr) AddShortcut ¶
AddShortcut adds given shortcut to given button.
func (*EventMgr) ClearNonFocus ¶
ClearNonFocus clears the focus of any non-w.Focus item.
func (*EventMgr) ClipBoard ¶
ClipBoard returns the goosi clip.Board, supplying the window context if available.
func (*EventMgr) DeleteShortcut ¶
DeleteShortcut deletes given shortcut
func (*EventMgr) DragClearSprite ¶
func (em *EventMgr) DragClearSprite()
func (*EventMgr) DragDrop ¶
DragDrop sends the events.Drop event to the top of the DragHovers stack. clearing the current dragging sprite before doing anything. It is up to the target to call
func (*EventMgr) DragMenuAddModLabel ¶
func (*EventMgr) DragStart ¶
DragStart starts a drag event, capturing a sprite image of the given widget and storing the data for later use during Drop
func (*EventMgr) DragStartCheck ¶
func (*EventMgr) DropFinalize ¶
DropFinalize should be called as the last step in the Drop event processing, to send the DropDeleteSource event to the source in case of DropMod == DropMove. Otherwise, nothing actually happens.
func (*EventMgr) FocusClear ¶
FocusClear saves current focus to FocusPrev
func (*EventMgr) FocusFirst ¶
FocusFirst sets the focus on the first focusable item in the tree. returns true if a focusable item was found.
func (*EventMgr) FocusLast ¶
FocusLast sets the focus on the last focusable item in the tree. returns true if a focusable item was found.
func (*EventMgr) FocusLastFrom ¶
FocusLastFrom sets the focus on the last focusable item in the given tree. returns true if a focusable item was found.
func (*EventMgr) FocusNext ¶
FocusNext sets the focus on the next item that can accept focus after the current Focus item. returns true if a focus item found.
func (*EventMgr) FocusNextFrom ¶
FocusNextFrom sets the focus on the next item that can accept focus after the given item. returns true if a focus item found.
func (*EventMgr) FocusOnOrNext ¶
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 ¶
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 ¶
FocusPrev sets the focus on the previous item before the current focus item.
func (*EventMgr) FocusPrevFrom ¶
FocusPrevFrom sets the focus on the previous item before the given item (can be nil).
func (*EventMgr) FocusWithins ¶
FocusWithins gets the FocusWithin containers of the current Focus event
func (*EventMgr) GetPriorityWidgets ¶
func (em *EventMgr) GetPriorityWidgets()
GetPriorityWidgets gathers Widgets with PriorityEvents set and also all widgets with Shortcuts
func (*EventMgr) HandleEvent ¶
func (*EventMgr) HandleFocusEvent ¶
func (*EventMgr) HandleLong ¶
func (em *EventMgr) HandleLong(e events.Event, deep Widget, w *Widget, pos *image.Point, t **time.Timer, styp, etyp events.Types, stime time.Duration, sdist int)
HandleLong is the implementation of EventMgr.HandleLongHover and [EventManger.HandleLongPress]. It handles the logic to do with tracking long events using the given pointers to event manager fields and constant type, time, and distance properties. It should not need to be called by anything except for the aforementioned functions.
func (*EventMgr) HandleLongHover ¶
HandleLongHover handles long hover events
func (*EventMgr) HandleLongPress ¶
HandleLongPress handles long press events
func (*EventMgr) HandleOtherEvent ¶
func (*EventMgr) HandlePosEvent ¶
func (*EventMgr) MainStageMgr ¶
MainStageMgr returns the MainStageMgr for our Main Stage
func (*EventMgr) ManagerKeyChordEvents ¶
MangerKeyChordEvents handles lower-priority manager-level key events. Mainly tab, shift-tab, and Inspector and Prefs. event will be marked as processed if handled here.
func (*EventMgr) ResetOnMouseDown ¶
func (em *EventMgr) ResetOnMouseDown()
func (*EventMgr) SetFocus ¶
SetFocus sets focus to given item, and returns true if focus changed. If item is nil, then nothing has focus. This does NOT send the events.Focus event to the widget. See [SetFocusEvent] for version that does send event.
func (*EventMgr) SetFocusEvent ¶
SetFocusEvent sets focus to given item, and returns true if focus changed. If item is nil, then nothing has focus. This sends the events.Focus event to the widget. See [SetFocus] for a version that does not.
func (*EventMgr) SetFocusImpl ¶
SetFocusImpl sets focus to given item -- returns true if focus changed. If item is nil, then nothing has focus. sendEvent determines whether the events.Focus event is sent to the focused item.
func (*EventMgr) SetStartFocus ¶
SetStartFocus sets the given item to be first focus when window opens.
func (*EventMgr) TopLongHover ¶
TopLongHover returns the top-most LongHoverable widget among the Hovers
func (*EventMgr) TriggerShortcut ¶
TriggerShortcut attempts to trigger a shortcut, returning true if one was triggered, and false otherwise. Also eliminates any shortcuts with deleted buttons, and does not trigger for Disabled buttons.
type FavPathItem ¶
type FavPathItem struct { // icon for item Ic icons.Icon // name of the favorite item Name string `width:"20"` // 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 Value system. Use this for any method args that are filenames to trigger use of FileViewDialog under FuncButton 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 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 Value.
type Frame ¶
type Frame struct { Layout // options for striped backgrounds -- rendered as darker bands relative to background color Stripes Stripes }
Frame is a Layout that renders a background according to the background-color style setting, and optional striping for grid layouts
func NewFrame ¶
NewFrame adds a new Frame with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*Frame) CopyFieldsFrom ¶
func (*Frame) FrameStdRender ¶
func (fr *Frame) FrameStdRender()
FrameStdRender does the standard rendering of the frame itself
func (*Frame) RenderStripes ¶
func (fr *Frame) RenderStripes()
func (*Frame) SetCustomContextMenu ¶
SetCustomContextMenu sets the [Frame.CustomContextMenu]
func (*Frame) SetStackTop ¶
SetStackTop sets the [Frame.StackTop]
func (*Frame) SetStripes ¶
SetStripes sets the [Frame.Stripes]: options for striped backgrounds -- rendered as darker bands relative to background color
func (*Frame) SetTooltip ¶
SetTooltip sets the [Frame.Tooltip]
type GeneralSettingsData ¶
type GeneralSettingsData struct { SettingsBase // the color theme Theme Themes // the primary color used to generate the color scheme Color color.RGBA // overall zoom factor as a percentage of the default zoom Zoom float32 `def:"100" min:"10" max:"1000" step:"10" format:"%g%%"` // the overall spacing factor as a percentage of the default amount of spacing // (higher numbers lead to more space and lower numbers lead to higher density) Spacing float32 `def:"100" min:"10" max:"1000" step:"10" format:"%g%%"` // the overall font size factor applied to all text as a percentage // of the default font size (higher numbers lead to larger text) FontSize float32 `def:"100" min:"10" max:"1000" step:"10" format:"%g%%"` // screen-specific preferences -- will override overall defaults if set ScreenPrefs map[string]ScreenPrefs // text highlighting style / theme HiStyle HiStyleName // whether to use a 24-hour clock (instead of AM and PM) Clock24 bool `label:"24-hour clock"` // parameters controlling GUI behavior Params ParamPrefs // editor preferences -- for TextEditor etc Editor EditorPrefs // select the active keymap from list of available keymaps -- see Edit KeyMaps for editing / saving / loading that list KeyMap keyfun.MapName // if set, the current available set of key maps is saved to your preferences directory, and automatically loaded at startup -- this should be set if you are using custom key maps, but it may be safer to keep it <i>OFF</i> if you are <i>not</i> using custom key maps, so that you'll always have the latest compiled-in standard key maps with all the current key functions bound to standard key chords SaveKeyMaps bool // if set, the detailed preferences are saved and loaded at startup -- only SaveDetailed bool // a custom style sheet -- add a separate Props entry for each type of object, e.g., button, or class using .classname, or specific named element using #name -- all are case insensitive CustomStyles ki.Props // if true my custom styles override other styling (i.e., they come <i>last</i> in styling process -- otherwise they provide defaults that can be overridden by app-specific styling (i.e, they come first). CustomStylesOverride bool // default font family when otherwise not specified FontFamily FontName // default mono-spaced font family MonoFont FontName // extra font paths, beyond system defaults -- searched first FontPaths []string // user info -- partially filled-out automatically if empty / when prefs first created User User // favorite paths, shown in FileViewer and also editable there FavPaths FavPaths // column to sort by in FileView, and :up or :down for direction -- updated automatically via FileView FileViewSort string `view:"-"` // filename for saving / loading colors ColorFilename FileName `view:"-" ext:".toml"` // flag that is set by StructView by virtue of changeflag tag, whenever an edit is made. Used to drive save menus etc. Changed bool `view:"-" changeflag:"+" json:"-" toml:"-" xml:"-"` }
GeneralSettingsData is the data type for the general Goki settings. The global current instance is stored as GeneralSettings.
func (*GeneralSettingsData) Apply ¶
func (pf *GeneralSettingsData) Apply()
Apply preferences to all the relevant settings.
func (*GeneralSettingsData) ApplyDPI ¶
func (pf *GeneralSettingsData) ApplyDPI()
ApplyDPI updates the screen LogicalDPI values according to current preferences and zoom factor, and then updates all open windows as well.
func (*GeneralSettingsData) DarkMode ¶
func (pf *GeneralSettingsData) DarkMode()
DarkMode sets the color theme to dark mode. It automatically saves the preferences and updates all of the windows.
func (*GeneralSettingsData) Defaults ¶
func (pf *GeneralSettingsData) Defaults()
func (*GeneralSettingsData) Delete ¶
func (pf *GeneralSettingsData) Delete() error
Delete deletes the preferences from the GoGi standard prefs directory. This is an unrecoverable action, and you should only do this if you are absolutely sure you want to. You may want to consider making a copy of your preferences through "Save as" before doing this.
func (*GeneralSettingsData) DeleteSavedWindowGeoms ¶
func (pf *GeneralSettingsData) 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 generally need to do this, but sometimes it is useful for testing or windows that are showing up in bad places that you can't recover from.
func (*GeneralSettingsData) DensityType ¶
func (pf *GeneralSettingsData) DensityType() Densities
DensityMul returns an enum value representing the type of density that the user has selected, based on a set of fixed breakpoints.
func (*GeneralSettingsData) EditDebug ¶
func (pf *GeneralSettingsData) EditDebug()
EditDebug opens the PrefsDbgView editor to control debugging parameters. These are not saved; they are only set dynamically during running.
func (*GeneralSettingsData) EditDetailed ¶
func (pf *GeneralSettingsData) EditDetailed()
EditDetailed 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; you can toggle that back off if you don't actually want to.
func (*GeneralSettingsData) EditHiStyles ¶
func (pf *GeneralSettingsData) EditHiStyles()
EditHiStyles opens the HiStyleView editor to customize highlighting styles
func (*GeneralSettingsData) EditKeyMaps ¶
func (pf *GeneralSettingsData) 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 (*GeneralSettingsData) LightMode ¶
func (pf *GeneralSettingsData) LightMode()
LightMode sets the color theme to light mode. It automatically saves the preferences and updates all of the windows.
func (*GeneralSettingsData) Open ¶
func (pf *GeneralSettingsData) Open() error
Open preferences from GoGi standard prefs directory
func (*GeneralSettingsData) PrefFontFamily ¶
func (pf *GeneralSettingsData) PrefFontFamily() string
PrefFontFamily returns the default FontFamily
func (*GeneralSettingsData) Save ¶
func (pf *GeneralSettingsData) Save() error
Save saves the preferences to the GoGi standard prefs directory
func (*GeneralSettingsData) SaveZoom ¶
func (pf *GeneralSettingsData) SaveZoom(forCurrentScreen bool)
SaveZoom saves the current LogicalDPI scaling, either as the overall default or specific to the current screen.
- forCurrentScreen: if true, saves only for current screen
func (*GeneralSettingsData) ScreenInfo ¶
func (pf *GeneralSettingsData) ScreenInfo() []*goosi.Screen
ScreenInfo returns screen info for all screens on the device
func (*GeneralSettingsData) TimeFormat ¶
func (pf *GeneralSettingsData) TimeFormat() string
TimeFormat returns the Go time format layout string that should be used for displaying times to the user, based on the value of [Prefs.Clock24].
func (*GeneralSettingsData) UpdateAll ¶
func (pf *GeneralSettingsData) UpdateAll()
UpdateAll updates all open windows with current preferences -- triggers rebuild of default styles.
func (*GeneralSettingsData) UpdateUser ¶
func (pf *GeneralSettingsData) UpdateUser()
UpdateUser gets the user info from the OS
func (*GeneralSettingsData) VersionInfo ¶
func (pf *GeneralSettingsData) VersionInfo() string
VersionInfo returns GoGi version information
type GeomCT ¶
type GeomCT struct { // Content is for the contents (children, parts) of the widget, // excluding the Space (margin, padding, scrollbars). // This content includes the InnerSpace factor (Gaps in Layout) // which must therefore be subtracted when allocating down to children. Content mat32.Vec2 // Total is for the total exterior of the widget: Content + Space Total mat32.Vec2 }
GeomCT has core layout elements: Content and Total
type GeomSize ¶
type GeomSize struct { // Actual is the actual size for the purposes of rendering, representing // the "external" demands of the widget for space from its parent. // This is initially the bottom-up constraint computed by SizeUp, // and only changes during SizeDown when wrapping elements are reshaped // based on allocated size, or when scrollbars are added. // For elements with scrollbars (OverflowAuto), the Actual size remains // at the initial style minimums, "absorbing" is internal size, // while Internal records the true size of the contents. // For SizeFinal, Actual size can Grow up to the final Alloc size, // while Internal records the actual bottom-up contents size. Actual GeomCT `view:"inline"` // Alloc is the top-down allocated size, based on available visible space, // starting from the Scene geometry and working downward, attempting to // accommodate the Actual contents, and allocating extra space based on // Grow factors. When Actual < Alloc, alignment factors determine positioning // within the allocated space. Alloc GeomCT `view:"inline"` // Internal is the internal size representing the true size of all contents // of the widget. This can be less than Actual.Content if widget has Grow // factors but its internal contents did not grow accordingly, or it can // be more than Actual.Content if it has scrollbars (OverflowAuto). // Note that this includes InnerSpace (Gap). Internal mat32.Vec2 // Space is the padding, total effective margin (border, shadow, etc), // and scrollbars that subtracts from Total size to get Content size. Space mat32.Vec2 // InnerSpace is total extra space that is included within the Content Size region // and must be subtracted from Content when passing sizes down to children. InnerSpace mat32.Vec2 // Min is the Styles.Min.Dots() (Ceil int) that constrains the Actual.Content size Min mat32.Vec2 // Max is the Styles.Max.Dots() (Ceil int) that constrains the Actual.Content size Max mat32.Vec2 }
GeomSize has all of the relevant Layout sizes
func (*GeomSize) FitSizeMax ¶
func (ls *GeomSize) FitSizeMax(to *mat32.Vec2, fm mat32.Vec2)
FitSizeMax increases given size to fit given fm value, subject to Max constraints
func (*GeomSize) SetContentFromTotal ¶
SetContentFromTotal sets the Content from Total size, subtracting Space
func (*GeomSize) SetInitContentMin ¶
func (ls *GeomSize) SetInitContentMin(styMin mat32.Vec2)
SetInitContentMin sets initial Actual.Content size from given Styles.Min, further subject to the current Max constraint.
func (*GeomSize) SetTotalFromContent ¶
SetTotalFromContent sets the Total size as Content plus Space
type GeomState ¶
type GeomState struct { // Size has sizing data for the widget: use Actual for rendering. // Alloc shows the potentially larger space top-down allocated. Size GeomSize `view:"add-fields"` // Pos is position within the overall Scene that we render into, // including effects of scroll offset, for both Total outer dimension // and inner Content dimension. Pos GeomCT `view:"inline" edit:"-" copy:"-" json:"-" xml:"-" set:"-"` // Cell is the logical X, Y index coordinates (col, row) of element // within its parent layout Cell image.Point // RelPos is top, left position relative to parent Content size space RelPos mat32.Vec2 // Scroll is additional scrolling offset within our parent layout Scroll mat32.Vec2 // 2D bounding box for Actual.Total size occupied within parent Scene // that we render onto, starting at Pos.Total and ending at Pos.Total + Size.Total. // These are the pixels we can draw into, intersected with parent bounding boxes // (empty for invisible). Used for render Bounds clipping. // This includes all space (margin, padding etc). TotalBBox image.Rectangle `edit:"-" copy:"-" json:"-" xml:"-" set:"-"` // 2D bounding box for our Content, which excludes our padding, margin, etc. // starting at Pos.Content and ending at Pos.Content + Size.Content. // It is intersected with parent bounding boxes. ContentBBox image.Rectangle `edit:"-" copy:"-" json:"-" xml:"-" set:"-"` }
GeomState contains the the layout geometry state for each widget. Set by the parent Layout during the Layout process.
func (*GeomState) ContentRangeDim ¶
ContentRangeDim returns the Content bounding box min, max along given dimension
func (*GeomState) ContentRect ¶
ContentRect returns Pos.Content, Size.Actual.Content as an image.Rectangle, e.g., for bounding box.
type Handle ¶
type Handle struct { Box // dimension along which the handle slides (opposite of the dimension it is longest on) Dim mat32.Dims // Min is the minimum value that the handle can go to // (typically the lower bound of the dialog/splits) Min float32 // Max is the maximum value that the handle can go to // (typically the upper bound of the dialog/splits) Max float32 // Pos is the current position of the handle on the // scale of [Handle.Min] to [Handle.Max] Pos float32 }
Handle represents a draggable handle that can be used to control the size of an element.
func NewHandle ¶
NewHandle adds a new Handle with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*Handle) HandleEvents ¶
func (hl *Handle) HandleEvents()
func (*Handle) SetCustomContextMenu ¶
SetCustomContextMenu sets the [Handle.CustomContextMenu]
func (*Handle) SetDim ¶
SetDim sets the [Handle.Dim]: dimension along which the handle slides (opposite of the dimension it is longest on)
func (*Handle) SetMax ¶
SetMax sets the [Handle.Max]: Max is the maximum value that the handle can go to (typically the upper bound of the dialog/splits)
func (*Handle) SetMin ¶
SetMin sets the [Handle.Min]: Min is the minimum value that the handle can go to (typically the lower bound of the dialog/splits)
func (*Handle) SetPos ¶
SetPos sets the [Handle.Pos]: Pos is the current position of the handle on the scale of [Handle.Min] to [Handle.Max]
func (*Handle) SetTooltip ¶
SetTooltip sets the [Handle.Tooltip]
type Icon ¶
type Icon struct { WidgetBase // icon name that has been set. IconName icons.Icon `set:"-"` // file name for the loaded icon, if loaded Filename string `set:"-"` // SVG drawing SVG svg.SVG `set:"-"` // RendSize is the last rendered size of the Icon SVG. // if the SVG.Name == IconName and this size is the same // then the current SVG image is used. RendSize image.Point `set:"-"` }
Icon contains a svg.SVG element. The rendered version is cached for a given size.
func NewIcon ¶
NewIcon adds a new Icon with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*Icon) CopyFieldsFrom ¶
func (*Icon) DrawIntoScene ¶
func (ic *Icon) DrawIntoScene()
func (*Icon) RenderSVG ¶
func (ic *Icon) RenderSVG()
RenderSVG renders the SVG to Pixels if needs update
func (*Icon) SetCustomContextMenu ¶
SetCustomContextMenu sets the [Icon.CustomContextMenu]
func (*Icon) SetIcon ¶
SetIcon sets the icon, logging error if not found. Does nothing if IconName is already == icon name.
func (*Icon) SetIconTry ¶
SetIconTry sets the icon, returning error message if not found etc, and returning true if a new icon was actually set. Does nothing and returns false if IconName is already == icon name.
func (*Icon) SetIconUpdate ¶
SetIconUpdate sets the icon and sets flag to render. Does nothing if IconName is already == icon name.
func (*Icon) SetTooltip ¶
SetTooltip sets the [Icon.Tooltip]
type Image ¶
type Image struct { WidgetBase // file name of image loaded -- set by OpenImage Filename FileName `set:"-"` // the bitmap image Pixels *image.RGBA `copy:"-" view:"-" xml:"-" json:"-" set:"-"` // cached last rendered image PrevPixels image.Image `copy:"-" xml:"-" json:"-" set:"-"` // cached [styles.Style.ObjectFit] of the last rendered image PrevObjectFit styles.ObjectFits `copy:"-" xml:"-" json:"-" set:"-"` // cached allocated size for the last rendered image PrevSize mat32.Vec2 `copy:"-" xml:"-" json:"-" set:"-"` }
Image is a Widget that renders a static bitmap image. See [Styles.ObjectFits] for how to control the image rendering within the allocated size. The minimum requested size is the pixel size in Dp units (1/160th of an inch).
func NewImage ¶
NewImage adds a new Image with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*Image) ConfigToolbar ¶
ConfigToolbar can be used to configure a toolbar for image
func (*Image) CopyFieldsFrom ¶
func (*Image) DrawIntoScene ¶
func (im *Image) DrawIntoScene()
func (*Image) GrabRenderFrom ¶
GrabRenderFrom grabs the rendered image from given node
func (*Image) OpenImageFS ¶
OpenImageFS sets the image to the image located at the given filename in the given fs.
func (*Image) SetCustomContextMenu ¶
SetCustomContextMenu sets the [Image.CustomContextMenu]
func (*Image) SetImage ¶
SetImage sets the image to the given image. It copies from the given image into an internal image.
func (*Image) SetSize ¶
SetSize is a convenience method to ensure that the image is given size. A new image will be created of the given size if the current one is not of the specified size.
func (*Image) SetTooltip ¶
SetTooltip sets the [Image.Tooltip]
type Label ¶
type Label struct { WidgetBase // label to display Text string // the type of label Type LabelTypes // render data for text label TextRender paint.Text `copy:"-" xml:"-" json:"-" set:"-"` }
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 AsLabel ¶
func AsLabel(k ki.Ki) *Label
AsLabel returns the given value as a value of type Label if the type of the given value embeds Label, or nil otherwise
func NewLabel ¶
NewLabel adds a new Label with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*Label) AsLabel ¶
AsLabel satisfies the LabelEmbedder interface
func (*Label) ConfigLabel ¶
func (lb *Label) ConfigLabel()
ConfigLabel does the HTML and Layout in TextRender for label text, using actual content size to constrain layout.
func (*Label) ConfigLabelAlloc ¶
func (lb *Label) ConfigLabelAlloc(sz mat32.Vec2) mat32.Vec2
ConfigLabelAlloc is used for determining how much space the label takes, using given size (typically Alloc). In this case, alignment factors are turned off, because they otherwise can absorb much more space, which should instead be controlled by the base Align X,Y factors.
func (*Label) ConfigLabelSize ¶
func (lb *Label) ConfigLabelSize(sz mat32.Vec2)
ConfigLabel does the HTML and Layout in TextRender for label text, using given size to constrain layout.
func (*Label) ConfigWidget ¶
func (lb *Label) ConfigWidget()
func (*Label) CopyFieldsFrom ¶
func (*Label) HandleEvents ¶
func (lb *Label) HandleEvents()
func (*Label) HandleLabelClick ¶
HandleLabelClick handles click events such that the given function will be called on any links that are clicked on.
func (*Label) RenderLabel ¶
func (lb *Label) RenderLabel()
func (*Label) SetCustomContextMenu ¶
SetCustomContextMenu sets the [Label.CustomContextMenu]
func (*Label) SetTextUpdate ¶
SetTextUpdate sets the text and updates the underlying render (i.e., ConfigLabel) so it will actually show on next render. (including an UpdateRender flag)
func (*Label) SetTooltip ¶
SetTooltip sets the [Label.Tooltip]
func (*Label) SetType ¶
func (t *Label) SetType(v LabelTypes) *Label
SetType sets the [Label.Type]: the type of label
func (*Label) SizeUpWrapSize ¶
func (lb *Label) SizeUpWrapSize() mat32.Vec2
SizeUpWrapSize is the size to use for layout during the SizeUp pass, for word wrap case, where the sizing actually matters. this is based on the existing styled Actual.Content aspect ratio and very rough estimate of total rendered size.
type LabelEmbedder ¶
type LabelEmbedder interface {
AsLabel() *Label
}
LabelEmbedder is an interface that all types that embed Label satisfy
type LabelTypes ¶
type LabelTypes int32 //enums:enum -trim-prefix Label
LabelTypes is an enum containing the different possible types of labels
const ( // LabelDisplayLarge is a large, short, and important // display label with a default font size of 57dp. LabelDisplayLarge LabelTypes = iota // LabelDisplayMedium is a medium-sized, short, and important // display label with a default font size of 45dp. LabelDisplayMedium // LabelDisplaySmall is a small, short, and important // display label with a default font size of 36dp. LabelDisplaySmall // LabelHeadlineLarge is a large, high-emphasis // headline label with a default font size of 32dp. LabelHeadlineLarge // LabelHeadlineMedium is a medium-sized, high-emphasis // headline label with a default font size of 28dp. LabelHeadlineMedium // LabelHeadlineSmall is a small, high-emphasis // headline label with a default font size of 24dp. LabelHeadlineSmall // LabelTitleLarge is a large, medium-emphasis // title label with a default font size of 22dp. LabelTitleLarge // LabelTitleMedium is a medium-sized, medium-emphasis // title label with a default font size of 16dp. LabelTitleMedium // LabelTitleSmall is a small, medium-emphasis // title label with a default font size of 14dp. LabelTitleSmall // LabelBodyLarge is a large body label used for longer // passages of text with a default font size of 16dp. LabelBodyLarge // LabelBodyMedium is a medium-sized body label used for longer // passages of text with a default font size of 14dp. LabelBodyMedium // LabelBodySmall is a small body label used for longer // passages of text with a default font size of 12dp. LabelBodySmall // LabelLabelLarge is a large label used for label text (like a caption // or the text inside a button) with a default font size of 14dp. LabelLabelLarge // LabelLabelMedium is a medium-sized label used for label text (like a caption // or the text inside a button) with a default font size of 12dp. LabelLabelMedium // LabelLabelSmall is a small label used for label text (like a caption // or the text inside a button) with a default font size of 11dp. LabelLabelSmall )
const LabelTypesN LabelTypes = 15
LabelTypesN is the highest valid value for type LabelTypes, plus one.
func LabelTypesValues ¶
func LabelTypesValues() []LabelTypes
LabelTypesValues returns all possible values for the type LabelTypes.
func (LabelTypes) Desc ¶
func (i LabelTypes) Desc() string
Desc returns the description of the LabelTypes value.
func (LabelTypes) Int64 ¶
func (i LabelTypes) Int64() int64
Int64 returns the LabelTypes value as an int64.
func (LabelTypes) IsValid ¶
func (i LabelTypes) IsValid() bool
IsValid returns whether the value is a valid option for type LabelTypes.
func (LabelTypes) MarshalText ¶
func (i LabelTypes) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (*LabelTypes) SetInt64 ¶
func (i *LabelTypes) SetInt64(in int64)
SetInt64 sets the LabelTypes value from an int64.
func (*LabelTypes) SetString ¶
func (i *LabelTypes) SetString(s string) error
SetString sets the LabelTypes value from its string representation, and returns an error if the string is invalid.
func (LabelTypes) String ¶
func (i LabelTypes) String() string
String returns the string representation of this LabelTypes value.
func (*LabelTypes) UnmarshalText ¶
func (i *LabelTypes) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (LabelTypes) Values ¶
func (i LabelTypes) Values() []enums.Enum
Values returns all possible values for the type LabelTypes.
type LabeledTextField ¶
type LabeledTextField struct { TextField // Label is the label for the text field Label string // HintText is the hint text for the text field HintText string // ErrorText is the error text for the text field. // If it is specified, it will be shown instead of // [LabeledTextField.HintText]. ErrorText string }
LabeledTextField is a Label with optional associated label, hint, and error text.
func NewLabeledTextField ¶
func NewLabeledTextField(par ki.Ki, name ...string) *LabeledTextField
NewLabeledTextField adds a new LabeledTextField with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*LabeledTextField) ConfigParts ¶
func (lt *LabeledTextField) ConfigParts()
func (*LabeledTextField) ConfigWidget ¶
func (lt *LabeledTextField) ConfigWidget()
func (*LabeledTextField) KiType ¶
func (t *LabeledTextField) KiType() *gti.Type
KiType returns the *gti.Type of LabeledTextField
func (*LabeledTextField) New ¶
func (t *LabeledTextField) New() ki.Ki
New returns a new *LabeledTextField value
func (*LabeledTextField) SetClass ¶
func (t *LabeledTextField) SetClass(v string) *LabeledTextField
SetClass sets the [LabeledTextField.Class]
func (*LabeledTextField) SetComplete ¶
func (t *LabeledTextField) SetComplete(v *Complete) *LabeledTextField
SetComplete sets the [LabeledTextField.Complete]
func (*LabeledTextField) SetCursorColor ¶
func (t *LabeledTextField) SetCursorColor(v image.Image) *LabeledTextField
SetCursorColor sets the [LabeledTextField.CursorColor]
func (*LabeledTextField) SetCursorWidth ¶
func (t *LabeledTextField) SetCursorWidth(v units.Value) *LabeledTextField
SetCursorWidth sets the [LabeledTextField.CursorWidth]
func (*LabeledTextField) SetCustomContextMenu ¶
func (t *LabeledTextField) SetCustomContextMenu(v func(m *Scene)) *LabeledTextField
SetCustomContextMenu sets the [LabeledTextField.CustomContextMenu]
func (*LabeledTextField) SetErrorText ¶
func (t *LabeledTextField) SetErrorText(v string) *LabeledTextField
SetErrorText sets the [LabeledTextField.ErrorText]: ErrorText is the error text for the text field. If it is specified, it will be shown instead of [LabeledTextField.HintText].
func (*LabeledTextField) SetHintText ¶
func (t *LabeledTextField) SetHintText(v string) *LabeledTextField
SetHintText sets the [LabeledTextField.HintText]: HintText is the hint text for the text field
func (*LabeledTextField) SetLabel ¶
func (t *LabeledTextField) SetLabel(v string) *LabeledTextField
SetLabel sets the [LabeledTextField.Label]: Label is the label for the text field
func (*LabeledTextField) SetLeadingIconOnClick ¶
func (t *LabeledTextField) SetLeadingIconOnClick(v func(e events.Event)) *LabeledTextField
SetLeadingIconOnClick sets the [LabeledTextField.LeadingIconOnClick]
func (*LabeledTextField) SetMaxWidthReq ¶
func (t *LabeledTextField) SetMaxWidthReq(v int) *LabeledTextField
SetMaxWidthReq sets the [LabeledTextField.MaxWidthReq]
func (*LabeledTextField) SetNoEcho ¶
func (t *LabeledTextField) SetNoEcho(v bool) *LabeledTextField
SetNoEcho sets the [LabeledTextField.NoEcho]
func (*LabeledTextField) SetPlaceholder ¶
func (t *LabeledTextField) SetPlaceholder(v string) *LabeledTextField
SetPlaceholder sets the [LabeledTextField.Placeholder]
func (*LabeledTextField) SetPlaceholderColor ¶
func (t *LabeledTextField) SetPlaceholderColor(v color.RGBA) *LabeledTextField
SetPlaceholderColor sets the [LabeledTextField.PlaceholderColor]
func (*LabeledTextField) SetSelectColor ¶
func (t *LabeledTextField) SetSelectColor(v image.Image) *LabeledTextField
SetSelectColor sets the [LabeledTextField.SelectColor]
func (*LabeledTextField) SetSelectMode ¶
func (t *LabeledTextField) SetSelectMode(v bool) *LabeledTextField
SetSelectMode sets the [LabeledTextField.SelectMode]
func (*LabeledTextField) SetTooltip ¶
func (t *LabeledTextField) SetTooltip(v string) *LabeledTextField
SetTooltip sets the [LabeledTextField.Tooltip]
func (*LabeledTextField) SetTrailingIconOnClick ¶
func (t *LabeledTextField) SetTrailingIconOnClick(v func(e events.Event)) *LabeledTextField
SetTrailingIconOnClick sets the [LabeledTextField.TrailingIconOnClick]
func (*LabeledTextField) SetType ¶
func (t *LabeledTextField) SetType(v TextFieldTypes) *LabeledTextField
SetType sets the [LabeledTextField.Type]
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 LayCell ¶
type LayCell struct { // Size has the Actual size of elements (not Alloc) Size mat32.Vec2 // Grow has the Grow factors Grow mat32.Vec2 }
LayCell holds the layout implementation data for col, row Cells
type LayCells ¶
type LayCells struct { // Shape is number of cells along each dimension for our ColRow cells, Shape image.Point `edit:"-"` // ColRow has the data for the columns in [0] and rows in [1]: // col Size.X = max(X over rows) (cross axis), .Y = sum(Y over rows) (main axis for col) // row Size.X = sum(X over cols) (main axis for row), .Y = max(Y over cols) (cross axis) // see: https://docs.google.com/spreadsheets/d/1eimUOIJLyj60so94qUr4Buzruj2ulpG5o6QwG2nyxRw/edit?usp=sharing ColRow [2][]LayCell `edit:"-"` }
LayCells holds one set of LayCell cell elements for rows, cols. There can be multiple of these for Wrap case.
func (*LayCells) Cell ¶
Cell returns the cell for given dimension and index along that dimension (X = Cols, idx = col, Y = Rows, idx = row)
func (*LayCells) CellsSize ¶
func (lc *LayCells) CellsSize() mat32.Vec2
CellsSize returns the total Size represented by the current Cells, which is the Sum of the Max values along each dimension.
func (*LayCells) GapSizeDim ¶
GapSizeDim returns the gap size for given dimension, based on Shape and given gap size
type LayImplState ¶
type LayImplState struct { // Shape is number of cells along each dimension, // computed for each layout type: // For Grid: Max Col, Row. // For Flex no Wrap: Cols,1 (X) or 1,Rows (Y). // For Flex Wrap: Cols,Max(Rows) or Max(Cols),Rows // For Stacked: 1,1 Shape image.Point `edit:"-"` // MainAxis cached here from Styles, to enable Wrap-based access. MainAxis mat32.Dims // Wraps is the number of actual items in each Wrap for Wrap case: // MainAxis X: Len = Rows, Val = Cols; MainAxis Y: Len = Cols, Val = Rows. // This should be nil for non-Wrap case. Wraps []int // Cells has the Actual size and Grow factor data for each of the child elements, // organized according to the Shape and Display type. // For non-Wrap, has one element in slice, with cells based on Shape. // For Wrap, slice is number of CrossAxis wraps allocated: // MainAxis X = Rows; MainAxis Y = Cols, and Cells are MainAxis layout x 1 CrossAxis. Cells []LayCells `edit:"-"` // ScrollSize has the scrollbar sizes (widths) for each dim, which adds to Space. // If there is a vertical scrollbar, X has width; if horizontal, Y has "width" = height ScrollSize mat32.Vec2 // Gap is the Styles.Gap size Gap mat32.Vec2 // GapSize has the total extra gap sizing between elements, which adds to Space. // This depends on cell layout so it can vary for Wrap case. // For SizeUp / Down Gap contributes to Space like other cases, // but for BoundingBox rendering and Alignment, it does NOT, and must be // subtracted. This happens in the Position phase. GapSize mat32.Vec2 }
LayImplState has internal state for implementing layout
func (*LayImplState) Cell ¶
func (ls *LayImplState) Cell(d mat32.Dims, dIdx, odIdx int) *LayCell
Cell returns the cell for given dimension and index along that dimension, and given other-dimension axis which is ignored for non-Wrap cases. Does no range checking and will crash if out of bounds.
func (*LayImplState) CellsSize ¶
func (ls *LayImplState) CellsSize() mat32.Vec2
CellsSize returns the total Size represented by the current Cells, which is the Sum of the Max values along each dimension within each Cell, Maxed over cross-axis dimension for Wrap case, plus GapSize.
func (*LayImplState) ColWidth ¶
func (ls *LayImplState) ColWidth(row, col int) (float32, error)
ColWidth returns the width of given column for given row index (ignored for non-Wrap), with full bounds checking. Returns error if out of range.
func (*LayImplState) InitCells ¶
func (ls *LayImplState) InitCells()
InitCells initializes the Cells based on Shape, MainAxis, and Wraps which must be set before calling.
func (*LayImplState) RowHeight ¶
func (ls *LayImplState) RowHeight(row, col int) (float32, error)
RowHeight returns the height of given row for given column (ignored for non-Wrap), with full bounds checking. Returns error if out of range.
func (*LayImplState) ShapeCheck ¶
func (ls *LayImplState) ShapeCheck(w Widget, phase string) bool
func (*LayImplState) String ¶
func (ls *LayImplState) String() string
func (*LayImplState) WrapIdxToCoord ¶
func (ls *LayImplState) WrapIdxToCoord(idx int) image.Point
WrapIdxToCoord returns the X,Y coordinates in Wrap case for given sequential idx
type Layout ¶
type Layout struct { WidgetBase // for Stacked layout, index of node to use as the top of the stack. // Only the node at this index is rendered -- if not a valid index, nothing is rendered. StackTop int // LayImpl contains implementational state info for doing layout LayImpl LayImplState `edit:"-" copy:"-" json:"-" xml:"-" set:"-"` // whether scrollbar is used for given dim HasScroll [2]bool `edit:"-" copy:"-" json:"-" xml:"-" set:"-"` // scroll bars -- we fully manage them as needed Scrolls [2]*Slider `edit:"-" copy:"-" json:"-" xml:"-" set:"-"` // accumulated name to search for when keys are typed FocusName string `edit:"-" copy:"-" json:"-" xml:"-" set:"-"` // time of last focus name event -- for timeout FocusNameTime time.Time `edit:"-" copy:"-" json:"-" xml:"-" set:"-"` // last element focused on -- used as a starting point if name is the same FocusNameLast ki.Ki `edit:"-" copy:"-" json:"-" xml:"-" set:"-"` }
Layout is the primary node type responsible for organizing the sizes and positions of child widgets. It does not render, only organize, so properties like background color will have no effect. All arbitrary collections of widgets should generally be contained within a layout -- otherwise the parent widget must take over responsibility for positioning. 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.
func AsLayout ¶
func AsLayout(k ki.Ki) *Layout
AsLayout returns the given value as a value of type Layout if the type of the given value embeds Layout, or nil otherwise
func NewLayout ¶
NewLayout adds a new Layout with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*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) 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) ClosePopup ¶
ClosePopup closes the parent Stage as a PopupStage. Returns false if not a popup.
func (*Layout) ConfigScroll ¶
func (ly *Layout) ConfigScroll(d mat32.Dims)
ConfigScroll configures scroll for given dimension
func (*Layout) ConfigScrolls ¶
func (ly *Layout) ConfigScrolls()
ConfigScrolls configures any scrollbars that have been enabled during the Layout process. This is called during Position, once the sizing and need for scrollbars has been established. The final position of the scrollbars is set during ScenePos in PositionScrolls. Scrolls are kept around in general.
func (*Layout) CopyFieldsFrom ¶
func (*Layout) DeleteScroll ¶
func (ly *Layout) DeleteScroll(d mat32.Dims)
DeleteScroll deletes scrollbar along given dimesion.
func (*Layout) FlagType ¶
func (ly *Layout) FlagType() enums.BitFlagSetter
func (*Layout) FocusNextChild ¶
FocusNextChild attempts to move the focus into the next layout child (with wraparound to start) -- returns true if successful. if updn is true, then for Grid layouts, it moves down to next row instead of just the sequentially next item.
func (*Layout) FocusOnName ¶
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. If updn is true, then for Grid layouts, it moves up to next row instead of just the sequentially next item.
func (*Layout) GetScrollPosition ¶
func (ly *Layout) GetScrollPosition()
GetScrollPosition sets our layout Scroll position from scrollbars
func (*Layout) HandleEvents ¶
func (ly *Layout) HandleEvents()
func (*Layout) HandleKeys ¶
func (ly *Layout) HandleKeys()
HandleKeys handles all key events for navigating focus within a Layout. Typically this is done by the parent Scene level layout, but can be done by default if FocusWithinable Ability is set.
func (*Layout) HasAnyScroll ¶
HasAnyScroll returns true if layout has
func (*Layout) LaySetContentFitOverflow ¶
func (ly *Layout) LaySetContentFitOverflow(nsz mat32.Vec2, pass LayoutPasses)
LaySetContentFitOverflow sets Internal and Actual.Content size to fit given new content size, depending on the Styles Overflow: Auto and Scroll types do NOT expand Actual and remain at their current styled actual values, absorbing the extra content size within their own scrolling zone (full size recorded in Internal).
func (*Layout) LaySetGapSizeFromCells ¶
func (ly *Layout) LaySetGapSizeFromCells()
func (*Layout) LaySetInitCells ¶
func (ly *Layout) LaySetInitCells()
SetInitCells sets the initial default assignment of cell indexes to each widget, based on layout type.
func (*Layout) LaySetInitCellsFlex ¶
func (ly *Layout) LaySetInitCellsFlex()
func (*Layout) LaySetInitCellsGrid ¶
func (ly *Layout) LaySetInitCellsGrid()
func (*Layout) LaySetInitCellsStacked ¶
func (ly *Layout) LaySetInitCellsStacked()
func (*Layout) LaySetInitCellsWrap ¶
func (ly *Layout) LaySetInitCellsWrap()
func (*Layout) LaySetWrapIdxs ¶
func (ly *Layout) LaySetWrapIdxs()
LaySetWrapIdxs sets indexes for Wrap case
func (*Layout) LayoutSpace ¶
func (ly *Layout) LayoutSpace()
LayoutSpace sets our Space based on Styles and Scroll. Other layout types can change this if they want to.
func (*Layout) ManageOverflow ¶
ManageOverflow uses overflow settings to determine if scrollbars are needed (Internal > Alloc). Returns true if size changes as a result. If updtSize is false, then the Actual and Alloc sizes are NOT updated as a result of change from adding scrollbars (generally should be true, but some cases not)
func (*Layout) Position ¶
func (ly *Layout) Position()
Position: uses the final sizes to position everything within layouts according to alignment settings.
func (*Layout) PositionCells ¶
func (ly *Layout) PositionCells()
func (*Layout) PositionLay ¶
func (ly *Layout) PositionLay()
func (*Layout) PositionScroll ¶
func (ly *Layout) PositionScroll(d mat32.Dims)
func (*Layout) PositionScrolls ¶
func (ly *Layout) PositionScrolls()
PositionScrolls arranges scrollbars
func (*Layout) PositionStacked ¶
func (ly *Layout) PositionStacked()
func (*Layout) PositionWrap ¶
func (ly *Layout) PositionWrap()
func (*Layout) RenderChildren ¶
func (ly *Layout) RenderChildren()
func (*Layout) ScenePos ¶
func (ly *Layout) ScenePos()
ScenePos: scene-based position and final BBox is computed based on parents accumulated position and scrollbar position. This step can be performed when scrolling after updating Scroll.
func (*Layout) ScenePosChildren ¶
func (ly *Layout) ScenePosChildren()
ScenePosChildren runs ScenePos on the children
func (*Layout) ScenePosLay ¶
func (ly *Layout) ScenePosLay()
func (*Layout) ScrollActionDelta ¶
ScrollActionDelta moves the scrollbar in given dimension by given delta and emits a ScrollSig signal.
func (*Layout) ScrollActionPos ¶
ScrollActionPos moves the scrollbar in given dimension to given position and emits a ScrollSig signal.
func (*Layout) ScrollDelta ¶
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) ScrollGeom ¶
func (ly *Layout) ScrollGeom(d mat32.Dims) (pos, sz mat32.Vec2)
ScrollGeom returns the target position and size for scrollbars
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 target [min..max] range 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 ¶
ScrollToPos moves the scrollbar in given dimension to given position and DOES NOT emit a ScrollSig signal.
func (*Layout) SetCustomContextMenu ¶
SetCustomContextMenu sets the [Layout.CustomContextMenu]
func (*Layout) SetScrollsOff ¶
func (ly *Layout) SetScrollsOff()
SetScrollsOff turns off the scrollbars
func (*Layout) SetStackTop ¶
SetStackTop sets the [Layout.StackTop]: for Stacked layout, index of node to use as the top of the stack. Only the node at this index is rendered -- if not a valid index, nothing is rendered.
func (*Layout) SetTooltip ¶
SetTooltip sets the [Layout.Tooltip]
func (*Layout) SizeDownAllocActual ¶
SizeDownAllocActual sets Alloc to Actual for no-extra case.
func (*Layout) SizeDownAllocActualCells ¶
SizeDownAllocActualCells sets Alloc to Actual for no-extra case. Note however that due to max sizing for row / column, this size can actually be different than original actual.
func (*Layout) SizeDownAllocActualStacked ¶
func (*Layout) SizeDownChildren ¶
SizeDownChildren calls SizeDown on the Children. The kids must have their Size.Alloc set prior to this, which is what Layout type does. Other special widget types can do custom layout and call this too.
func (*Layout) SizeDownGrow ¶
SizeDownGrow grows the element sizes based on total extra and Grow
func (*Layout) SizeDownGrowCells ¶
func (*Layout) SizeDownGrowStacked ¶
func (*Layout) SizeDownLay ¶
SizeDownLay is the Layout standard SizeDown pass, returning true if another iteration is required. It allocates sizes to fit given parent-allocated total size.
func (*Layout) SizeDownSetAllocs ¶
SizeDownSetAllocs is the key SizeDown step that sets the allocations in the children, based on our allocation. In the default implementation this calls SizeDownGrow if there is extra space to grow, or SizeDownAllocActual to set the allocations as they currrently are.
func (*Layout) SizeDownWrap ¶
func (*Layout) SizeFinalChildren ¶
func (ly *Layout) SizeFinalChildren()
SizeFinalChildren calls SizeFinal on all the children of this node
func (*Layout) SizeFinalLay ¶
func (ly *Layout) SizeFinalLay()
SizeFinalLay is the Layout standard SizeFinal pass
func (*Layout) SizeFinalUpdateChildrenSizes ¶
func (ly *Layout) SizeFinalUpdateChildrenSizes()
SizeFinalUpdateChildrenSizes can optionally be called for layouts that dynamically create child elements based on final layout size. It ensures that the children are properly sized.
func (*Layout) SizeFromChildren ¶
func (ly *Layout) SizeFromChildren(iter int, pass LayoutPasses) mat32.Vec2
SizeFromChildren gathers Actual size from kids. Different Layout types can alter this to present different Content sizes for the layout process, e.g., if Content is sized to fit allocation, as in the TopAppBar and Sliceview types.
func (*Layout) SizeFromChildrenCells ¶
func (ly *Layout) SizeFromChildrenCells(iter int, pass LayoutPasses) mat32.Vec2
SizeFromChildrenCells for Flex, Grid
func (*Layout) SizeFromChildrenFit ¶
func (ly *Layout) SizeFromChildrenFit(iter int, pass LayoutPasses)
SizeFromChildrenFit gathers Actual size from kids, and calls LaySetContentFitOverflow to update Actual and Internal size based on this.
func (*Layout) SizeFromChildrenStacked ¶
func (ly *Layout) SizeFromChildrenStacked() mat32.Vec2
SizeFromChildrenStacked for stacked case
func (*Layout) SizeUpChildren ¶
func (ly *Layout) SizeUpChildren()
SizeUpChildren calls SizeUp on all the children of this node
func (*Layout) SizeUpLay ¶
func (ly *Layout) SizeUpLay()
SizeUpLay is the Layout standard SizeUp pass
func (*Layout) StackTopWidget ¶
func (ly *Layout) StackTopWidget() (Widget, *WidgetBase)
StackTopWidget returns the StackTop element as a widget
func (*Layout) UpdateStackedVisibility ¶
func (ly *Layout) UpdateStackedVisibility()
UpdateStackedVisbility updates the visibility for Stacked layouts so the StackTop widget is visible, and others are Invisible.
type LayoutFlags ¶
type LayoutFlags WidgetFlags //enums:bitflag -trim-prefix Layout
Layoutlags has bool flags for Layout
const ( // for stacked layout, only layout the top widget. // this is appropriate for e.g., tab layout, which does a full // redraw on stack changes, but not for e.g., check boxes which don't LayoutStackTopOnly LayoutFlags = LayoutFlags(WidgetFlagsN) + iota // true if this layout got a redo = true on previous iteration -- otherwise it just skips any re-layout on subsequent iteration LayoutNeedsRedo // LayoutNoKeys prevents processing of keyboard events for this layout. // By default, Layout handles focus navigation events, but if an // outer Widget handles these instead, then this should be set. LayoutNoKeys )
const LayoutFlagsN LayoutFlags = 11
LayoutFlagsN is the highest valid value for type LayoutFlags, plus one.
func LayoutFlagsValues ¶
func LayoutFlagsValues() []LayoutFlags
LayoutFlagsValues returns all possible values for the type LayoutFlags.
func (LayoutFlags) BitIndexString ¶
func (i LayoutFlags) BitIndexString() string
BitIndexString returns the string representation of this LayoutFlags value if it is a bit index value (typically an enum constant), and not an actual bit flag value.
func (LayoutFlags) Desc ¶
func (i LayoutFlags) Desc() string
Desc returns the description of the LayoutFlags value.
func (LayoutFlags) HasFlag ¶
func (i LayoutFlags) HasFlag(f enums.BitFlag) bool
HasFlag returns whether these bit flags have the given bit flag set.
func (LayoutFlags) Int64 ¶
func (i LayoutFlags) Int64() int64
Int64 returns the LayoutFlags value as an int64.
func (LayoutFlags) IsValid ¶
func (i LayoutFlags) IsValid() bool
IsValid returns whether the value is a valid option for type LayoutFlags.
func (LayoutFlags) MarshalText ¶
func (i LayoutFlags) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (*LayoutFlags) SetFlag ¶
func (i *LayoutFlags) SetFlag(on bool, f ...enums.BitFlag)
SetFlag sets the value of the given flags in these flags to the given value.
func (*LayoutFlags) SetInt64 ¶
func (i *LayoutFlags) SetInt64(in int64)
SetInt64 sets the LayoutFlags value from an int64.
func (*LayoutFlags) SetString ¶
func (i *LayoutFlags) SetString(s string) error
SetString sets the LayoutFlags value from its string representation, and returns an error if the string is invalid.
func (*LayoutFlags) SetStringOr ¶
func (i *LayoutFlags) SetStringOr(s string) error
SetStringOr sets the LayoutFlags value from its string representation while preserving any bit flags already set, and returns an error if the string is invalid.
func (LayoutFlags) String ¶
func (i LayoutFlags) String() string
String returns the string representation of this LayoutFlags value.
func (*LayoutFlags) UnmarshalText ¶
func (i *LayoutFlags) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (LayoutFlags) Values ¶
func (i LayoutFlags) Values() []enums.Enum
Values returns all possible values for the type LayoutFlags.
type LayoutPasses ¶
type LayoutPasses int32 //enums:enum
LayoutPasses is used for the SizeFromChildren method, which can potentially compute different sizes for different passes.
const ( SizeUpPass LayoutPasses = iota SizeDownPass SizeFinalPass )
const LayoutPassesN LayoutPasses = 3
LayoutPassesN is the highest valid value for type LayoutPasses, plus one.
func LayoutPassesValues ¶
func LayoutPassesValues() []LayoutPasses
LayoutPassesValues returns all possible values for the type LayoutPasses.
func (LayoutPasses) Desc ¶
func (i LayoutPasses) Desc() string
Desc returns the description of the LayoutPasses value.
func (LayoutPasses) Int64 ¶
func (i LayoutPasses) Int64() int64
Int64 returns the LayoutPasses value as an int64.
func (LayoutPasses) IsValid ¶
func (i LayoutPasses) IsValid() bool
IsValid returns whether the value is a valid option for type LayoutPasses.
func (LayoutPasses) MarshalText ¶
func (i LayoutPasses) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (*LayoutPasses) SetInt64 ¶
func (i *LayoutPasses) SetInt64(in int64)
SetInt64 sets the LayoutPasses value from an int64.
func (*LayoutPasses) SetString ¶
func (i *LayoutPasses) SetString(s string) error
SetString sets the LayoutPasses value from its string representation, and returns an error if the string is invalid.
func (LayoutPasses) String ¶
func (i LayoutPasses) String() string
String returns the string representation of this LayoutPasses value.
func (*LayoutPasses) UnmarshalText ¶
func (i *LayoutPasses) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (LayoutPasses) Values ¶
func (i LayoutPasses) Values() []enums.Enum
Values returns all possible values for the type LayoutPasses.
type Layouter ¶
type Layouter interface { Widget // AsLayout returns the base Layout type AsLayout() *Layout // LayoutSpace sets our Space based on Styles, Scroll, and Gap Spacing. // Other layout types can change this if they want to. LayoutSpace() // SizeFromChildren gathers Actual size from kids into our Actual.Content size. // Different Layout types can alter this to present different Content // sizes for the layout process, e.g., if Content is sized to fit allocation, // as in the TopAppBar and Sliceview types. SizeFromChildren(iter int, pass LayoutPasses) mat32.Vec2 // SizeDownSetAllocs is the key SizeDown step that sets the allocations // in the children, based on our allocation. In the default implementation // this calls SizeDownGrow if there is extra space to grow, or // SizeDownAllocActual to set the allocations as they currrently are. SizeDownSetAllocs(iter int) // ManageOverflow uses overflow settings to determine if scrollbars // are needed, based on difference between ActualOverflow (full actual size) // and Alloc allocation. Returns true if size changes as a result. // If updtSize is false, then the Actual and Alloc sizes are NOT // updated as a result of change from adding scrollbars // (generally should be true, but some cases not) ManageOverflow(iter int, updtSize bool) bool }
Layouter is the interface for layout functions, called by Layout widget type during the various Layout passes.
type NewItemsData ¶
type NewItemsData struct { // Number is the number of elements to create Number int // Type is the type of elements to create Type *gti.Type }
NewItemsData contains the data necessary to make a certain number of items of a certain type, which can be used with a StructView in new item dialogs.
type ParamPrefs ¶
type ParamPrefs struct { // the maximum time interval in msec between button press events to count as a double-click DoubleClickInterval time.Duration `min:"100" step:"50"` // how fast the scroll wheel moves -- typically pixels per wheel step but units can be arbitrary. It is generally impossible to standardize speed and variable across devices, and we don't have access to the system settings, so unfortunately you have to set it here. ScrollWheelSpeed float32 `min:"0.01" step:"1"` // controls whether the main menu is displayed locally at top of each window, in addition to 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. LocalMainMenu bool // only support closing the currently selected active tab; if this is set to true, pressing the close button on other tabs will take you to that tab, from which you can close it OnlyCloseActiveTab bool `def:"false"` // the amount that alternating rows and columns are highlighted when showing tabular data (set to 0 to disable zebra striping) ZebraStripeWeight float32 `def:"0" min:"0" max:"100" step:"1"` // the limit of file size, above which user will be prompted before opening / copying, etc. BigFileSize int `def:"10000000"` // maximum number of saved paths to save in FileView SavedPathsMax int // turn on smoothing in 3D rendering -- this should be on by default but if you get an error telling you to turn it off, then do so (because your hardware can't handle it) Smooth3D bool }
ParamPrefs contains misc parameters controlling GUI behavior.
func (*ParamPrefs) Defaults ¶
func (pf *ParamPrefs) Defaults()
type PrefsDebug ¶
type PrefsDebug struct { // reports trace of updates that trigger re-rendering (printfs to stdout) UpdateTrace *bool // reports trace of the nodes rendering (printfs to stdout) RenderTrace *bool // reports trace of all layouts (printfs to stdout) LayoutTrace *bool // reports trace of window events (printfs to stdout) WinEventTrace *bool // reports the stack trace leading up to win publish events which are expensive -- wrap multiple updates in UpdateStart / End to prevent WinRenderTrace *bool // WinGeomTrace records window geometry saving / loading functions WinGeomTrace *bool // reports trace of keyboard events (printfs to stdout) KeyEventTrace *bool // reports trace of event handling (printfs to stdout) EventTrace *bool // reports trace of DND events handling DNDTrace *bool // reports trace of Go language completion & lookup process GoCompleteTrace *bool // reports trace of Go language type parsing and inference process GoTypeTrace *bool // reports errors for viewif directives in struct field tags, for giv.StructView StructViewIfDebug *bool // flag that is set by StructView by virtue of changeflag tag, whenever an edit is made. Used to drive save menus etc. Changed bool `view:"-" changeflag:"+" json:"-" toml:"-" xml:"-"` }
PrefsDebug are debugging params
func (*PrefsDebug) Connect ¶
func (pf *PrefsDebug) Connect()
Connect connects debug fields with actual variables controlling debugging
func (*PrefsDebug) Profile ¶
func (pf *PrefsDebug) Profile()
Profile toggles profiling of program on or off, which does both targeted and global CPU and Memory profiling.
type PrefsDetailed ¶
type PrefsDetailed struct { // the maximum height of any menu popup panel in units of font height -- scroll bars are enforced beyond that size. MenuMaxHeight int `def:"30" min:"5" step:"1"` // the number of milliseconds to wait before initiating a regular mouse drag event (as opposed to a basic events.Press) DragStartTime time.Duration `def:"50" min:"5" max:"1000" step:"5"` // the number of pixels that must be moved before initiating a regular mouse drag event (as opposed to a basic events.Press) DragStartDist int `def:"4" min:"0" max:"100" step:"1"` // the number of milliseconds to wait before initiating a drag-n-drop event -- gotta drag it like you mean it SlideStartTime time.Duration `def:"200" min:"5" max:"1000" step:"5"` // the number of pixels that must be moved before initiating a drag-n-drop event -- gotta drag it like you mean it SlideStartDist int `def:"20" min:"0" max:"100" step:"1"` // the number of milliseconds to wait before initiating a hover event (e.g., for opening a tooltip) LongHoverTime time.Duration `def:"500" min:"10" max:"10000" step:"10"` // the maximum number of pixels that mouse can move and still register a Hover event LongHoverStopDist int `def:"50" min:"0" max:"1000" step:"1"` // the amount of time to wait before offering completions CompleteWaitDuration time.Duration `def:"0" min:"0" max:"10000" step:"10"` // the maximum number of completions offered in popup CompleteMaxItems int `def:"25" min:"5" step:"1"` // time interval for cursor blinking on and off -- set to 0 to disable blinking CursorBlinkTime time.Duration `def:"500" min:"0" max:"1000" step:"5"` // is amount of time to wait before trying to autoscroll again LayoutAutoScrollDelay time.Duration `def:"25" min:"1" step:"5"` // number of steps to take in PageUp / Down events in terms of number of items LayoutPageSteps int `def:"10" min:"1" step:"1"` // the amount of time between keypresses to combine characters into name to search for within layout -- starts over after this delay LayoutFocusNameTimeout time.Duration `def:"500" min:"0" max:"5000" step:"20"` // the amount of time since last focus name event to allow tab to focus on next element with same name. LayoutFocusNameTabTime time.Duration `def:"2000" min:"10" max:"10000" step:"100"` // open dialogs in separate windows -- else do as popups in main window DialogsSepRenderWin bool `def:"true"` // Maximum amount of clipboard history to retain TextEditorClipHistMax int `def:"100" min:"0" max:"1000" step:"5"` // maximum number of lines to look for matching scope syntax (parens, brackets) TextBufMaxScopeLines int `def:"100" min:"10" step:"10"` // text buffer max lines to use diff-based revert to more quickly update e.g., after file has been reformatted TextBufDiffRevertLines int `def:"10000" min:"0" step:"1000"` // text buffer max diffs to use diff-based revert to more quickly update e.g., after file has been reformatted -- if too many differences, just revert TextBufDiffRevertDiffs int `def:"20" min:"0" step:"1"` // number of milliseconds to wait before starting a new background markup process, after text changes within a single line (always does after line insertion / deletion) TextBufMarkupDelayMSec int `def:"1000" min:"100" step:"100"` // the number of map elements at or below which an inline representation of the map will be presented -- more convenient for small #'s of props MapInlineLen int `def:"2" min:"1" step:"1"` // the number of elemental struct fields at or below which an inline representation of the struct will be presented -- more convenient for small structs StructInlineLen int `def:"4" min:"2" step:"1"` // the number of slice elements below which inline will be used SliceInlineLen int `def:"4" min:"2" step:"1"` // flag that is set by StructView by virtue of changeflag tag, whenever an edit is made. Used to drive save menus etc. Changed bool `view:"-" changeflag:"+" json:"-" toml:"-" xml:"-"` }
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 saves current preferences to standard prefs_det.toml file, which is auto-loaded at startup
type ProgressBar ¶
type ProgressBar struct { Slider // maximum amount of progress to be achieved ProgMax int // progress increment when display is updated -- automatically computed from ProgMax at Start but can be overwritten ProgInc int // current progress level ProgCur int // mutex for updating progress ProgMu sync.Mutex `set:"-"` }
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 NewProgressBar ¶
func NewProgressBar(par ki.Ki, name ...string) *ProgressBar
NewProgressBar adds a new ProgressBar with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*ProgressBar) CopyFieldsFrom ¶
func (pb *ProgressBar) CopyFieldsFrom(frm any)
func (*ProgressBar) KiType ¶
func (t *ProgressBar) KiType() *gti.Type
KiType returns the *gti.Type of ProgressBar
func (*ProgressBar) OnInit ¶
func (pb *ProgressBar) OnInit()
func (*ProgressBar) ProgStep ¶
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) SetClass ¶
func (t *ProgressBar) SetClass(v string) *ProgressBar
SetClass sets the [ProgressBar.Class]
func (*ProgressBar) SetCustomContextMenu ¶
func (t *ProgressBar) SetCustomContextMenu(v func(m *Scene)) *ProgressBar
SetCustomContextMenu sets the [ProgressBar.CustomContextMenu]
func (*ProgressBar) SetDim ¶
func (t *ProgressBar) SetDim(v mat32.Dims) *ProgressBar
SetDim sets the [ProgressBar.Dim]
func (*ProgressBar) SetIcon ¶
func (t *ProgressBar) SetIcon(v icons.Icon) *ProgressBar
SetIcon sets the [ProgressBar.Icon]
func (*ProgressBar) SetInputThreshold ¶
func (t *ProgressBar) SetInputThreshold(v float32) *ProgressBar
SetInputThreshold sets the [ProgressBar.InputThreshold]
func (*ProgressBar) SetMax ¶
func (t *ProgressBar) SetMax(v float32) *ProgressBar
SetMax sets the [ProgressBar.Max]
func (*ProgressBar) SetMin ¶
func (t *ProgressBar) SetMin(v float32) *ProgressBar
SetMin sets the [ProgressBar.Min]
func (*ProgressBar) SetPageStep ¶
func (t *ProgressBar) SetPageStep(v float32) *ProgressBar
SetPageStep sets the [ProgressBar.PageStep]
func (*ProgressBar) SetPrec ¶
func (t *ProgressBar) SetPrec(v int) *ProgressBar
SetPrec sets the [ProgressBar.Prec]
func (*ProgressBar) SetProgCur ¶
func (t *ProgressBar) SetProgCur(v int) *ProgressBar
SetProgCur sets the [ProgressBar.ProgCur]: current progress level
func (*ProgressBar) SetProgInc ¶
func (t *ProgressBar) SetProgInc(v int) *ProgressBar
SetProgInc sets the [ProgressBar.ProgInc]: progress increment when display is updated -- automatically computed from ProgMax at Start but can be overwritten
func (*ProgressBar) SetProgMax ¶
func (t *ProgressBar) SetProgMax(v int) *ProgressBar
SetProgMax sets the [ProgressBar.ProgMax]: maximum amount of progress to be achieved
func (*ProgressBar) SetSnap ¶
func (t *ProgressBar) SetSnap(v bool) *ProgressBar
SetSnap sets the [ProgressBar.Snap]
func (*ProgressBar) SetStayInView ¶
func (t *ProgressBar) SetStayInView(v bool) *ProgressBar
SetStayInView sets the [ProgressBar.StayInView]
func (*ProgressBar) SetStep ¶
func (t *ProgressBar) SetStep(v float32) *ProgressBar
SetStep sets the [ProgressBar.Step]
func (*ProgressBar) SetStyles ¶
func (pb *ProgressBar) SetStyles()
func (*ProgressBar) SetThumbColor ¶
func (t *ProgressBar) SetThumbColor(v image.Image) *ProgressBar
SetThumbColor sets the [ProgressBar.ThumbColor]
func (*ProgressBar) SetThumbSize ¶
func (t *ProgressBar) SetThumbSize(v mat32.Vec2) *ProgressBar
SetThumbSize sets the [ProgressBar.ThumbSize]
func (*ProgressBar) SetTooltip ¶
func (t *ProgressBar) SetTooltip(v string) *ProgressBar
SetTooltip sets the [ProgressBar.Tooltip]
func (*ProgressBar) SetTrackSize ¶
func (t *ProgressBar) SetTrackSize(v float32) *ProgressBar
SetTrackSize sets the [ProgressBar.TrackSize]
func (*ProgressBar) SetValueColor ¶
func (t *ProgressBar) SetValueColor(v image.Image) *ProgressBar
SetValueColor sets the [ProgressBar.ValueColor]
func (*ProgressBar) Start ¶
func (pb *ProgressBar) Start(mx int)
func (*ProgressBar) UpdtBar ¶
func (pb *ProgressBar) UpdtBar()
type RenderContext ¶
type RenderContext struct { // Flags hold binary context state Flags RenderContextFlags // LogicalDPI is the current logical dots-per-inch resolution of the // window, which should be used for most conversion of standard units. LogicalDPI float32 // Size of the rendering window, in actual "dot" pixels used for rendering. Size image.Point // Mu is mutex for locking out rendering and any destructive updates. // it is Write locked during rendering to provide exclusive blocking // of any other updates, which are Read locked so that you don't // get caught in deadlocks among all the different Read locks. Mu sync.RWMutex }
RenderContext provides rendering context from outer RenderWin window to Stage and Scene elements to inform styling, layout and rendering. It also has the master Mutex for any updates to the window contents: use Read lock for anything updating.
func NewRenderContext ¶
func NewRenderContext() *RenderContext
NewRenderContext returns a new RenderContext initialized according to the main Screen size and LogicalDPI as initial defaults. The actual window size is set during Resized method, which is typically called after the window is created by the OS.
func (*RenderContext) HasFlag ¶
func (rc *RenderContext) HasFlag(flag enums.BitFlag) bool
HasFlag returns true if given flag is set
func (*RenderContext) ReadLock ¶
func (rc *RenderContext) ReadLock()
ReadLock should be called whenever modifying anything in the entire RenderWin context. Because it is a Read lock, it does _not_ block any other updates happening at the same time -- it only prevents the full Render from happening until these updates finish. Other direct resources must have their own separate Write locks to protect them. It is automatically called at the start of HandleEvents, so all standard Event-driven updates are automatically covered. Other update entry points, such as animations, need to call this. Always call corresponding Unlock in defer!
func (*RenderContext) ReadUnlock ¶
func (rc *RenderContext) ReadUnlock()
ReadUnlock must be called for each ReadLock, when done.
func (*RenderContext) SetFlag ¶
func (rc *RenderContext) SetFlag(on bool, flag ...enums.BitFlag)
SetFlag sets given flag(s) on or off
func (*RenderContext) String ¶
func (rc *RenderContext) String() string
func (*RenderContext) WriteLock ¶
func (rc *RenderContext) WriteLock()
WriteLock is only called by RenderWin during RenderWindow function when updating all widgets and rendering the screen. All others should call ReadLock. Always call corresponding Unlock in defer!
func (*RenderContext) WriteUnlock ¶
func (rc *RenderContext) WriteUnlock()
WriteUnlock must be called for each WriteLock, when done.
type RenderContextFlags ¶
type RenderContextFlags int64 //enums:bitflag -trim-prefix Render
RenderContextFlags represent RenderContext state
const ( // the window is visible and should be rendered to RenderVisible RenderContextFlags = iota // forces a rebuild of all scene elements RenderRebuild )
const RenderContextFlagsN RenderContextFlags = 2
RenderContextFlagsN is the highest valid value for type RenderContextFlags, plus one.
func RenderContextFlagsValues ¶
func RenderContextFlagsValues() []RenderContextFlags
RenderContextFlagsValues returns all possible values for the type RenderContextFlags.
func (RenderContextFlags) BitIndexString ¶
func (i RenderContextFlags) BitIndexString() string
BitIndexString returns the string representation of this RenderContextFlags value if it is a bit index value (typically an enum constant), and not an actual bit flag value.
func (RenderContextFlags) Desc ¶
func (i RenderContextFlags) Desc() string
Desc returns the description of the RenderContextFlags value.
func (RenderContextFlags) HasFlag ¶
func (i RenderContextFlags) HasFlag(f enums.BitFlag) bool
HasFlag returns whether these bit flags have the given bit flag set.
func (RenderContextFlags) Int64 ¶
func (i RenderContextFlags) Int64() int64
Int64 returns the RenderContextFlags value as an int64.
func (RenderContextFlags) IsValid ¶
func (i RenderContextFlags) IsValid() bool
IsValid returns whether the value is a valid option for type RenderContextFlags.
func (RenderContextFlags) MarshalText ¶
func (i RenderContextFlags) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (*RenderContextFlags) SetFlag ¶
func (i *RenderContextFlags) SetFlag(on bool, f ...enums.BitFlag)
SetFlag sets the value of the given flags in these flags to the given value.
func (*RenderContextFlags) SetInt64 ¶
func (i *RenderContextFlags) SetInt64(in int64)
SetInt64 sets the RenderContextFlags value from an int64.
func (*RenderContextFlags) SetString ¶
func (i *RenderContextFlags) SetString(s string) error
SetString sets the RenderContextFlags value from its string representation, and returns an error if the string is invalid.
func (*RenderContextFlags) SetStringOr ¶
func (i *RenderContextFlags) SetStringOr(s string) error
SetStringOr sets the RenderContextFlags value from its string representation while preserving any bit flags already set, and returns an error if the string is invalid.
func (RenderContextFlags) String ¶
func (i RenderContextFlags) String() string
String returns the string representation of this RenderContextFlags value.
func (*RenderContextFlags) UnmarshalText ¶
func (i *RenderContextFlags) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (RenderContextFlags) Values ¶
func (i RenderContextFlags) Values() []enums.Enum
Values returns all possible values for the type RenderContextFlags.
type RenderParams ¶
type RenderParams struct { // LogicalDPI is the current logical dots-per-inch resolution of the // window, which should be used for most conversion of standard units. LogicalDPI float32 // Size of the rendering window, in actual "dot" pixels used for rendering. Size image.Point }
RenderParams are the key RenderWin params that determine if a scene needs to be restyled since last render, if these params change.
func (*RenderParams) NeedsRestyle ¶
func (rp *RenderParams) NeedsRestyle(rc *RenderContext) bool
NeedsRestyle returns true if the current render context params differ from those used in last render.
func (*RenderParams) SaveRender ¶
func (rp *RenderParams) SaveRender(rc *RenderContext)
SaveRender grabs current render context params
type RenderScenes ¶
type RenderScenes struct { // starting index for this set of Scenes StartIdx int // max index (exclusive) for this set of Scenes MaxIdx int // set to true to flip Y axis in drawing these images FlipY bool // ordered list of scenes -- index is Drawer image index. Scenes []*Scene // SceneIdx holds the index for each scene -- used to detect changes in index SceneIdx map[*Scene]int }
RenderScenes are a list of Scene objects, compiled in rendering order, whose Pixels images are composed directly to the RenderWin window.
func (*RenderScenes) Add ¶
func (rs *RenderScenes) Add(sc *Scene, scIdx map[*Scene]int) int
Add adds a new node, returning index
func (*RenderScenes) DrawAll ¶
func (rs *RenderScenes) DrawAll(drw goosi.Drawer)
DrawAll does drw.Copy drawing call for all Scenes, using proper TextureSet for each of goosi.MaxTexturesPerSet Scenes.
func (*RenderScenes) SetIdxRange ¶
func (rs *RenderScenes) SetIdxRange(st, n int)
SetIdxRange sets the index range based on starting index and n
func (*RenderScenes) SetImages ¶
func (rs *RenderScenes) SetImages(drw goosi.Drawer)
SetImages calls drw.SetGoImage on all updated Scene images
type RenderWin ¶
type RenderWin struct { Flags WinFlags Name string // displayed name of window, for window manager etc. // Window object name is the internal handle and is used for tracking property info etc Title string // OS-specific window interface -- handles all the os-specific functions, including delivering events etc GoosiWin goosi.Window `json:"-" xml:"-"` // MainStageMgr controlling the Main Stage elements in this window. // The Render Context in this manager is the original source for all Stages. MainStageMgr StageMgr // RenderScenes are the Scene elements that draw directly to the window, // arranged in order, and continuously updated during Render. RenderScenes RenderScenes }
RenderWin provides an outer "actual" window where everything is rendered, and is the point of entry for all events coming in from user actions.
RenderWin contents are all managed by the StageMgr that handles Main Stage elements such as Window, Dialog, and Sheet, which in turn manage their own stack of Popup Stage elements such as Menu, Tooltip, etc. The contents of each Stage is provided by a Scene, containing Widgets, and the Stage Pixels image is drawn to the RenderWin in the RenderWindow method.
Rendering is handled by the vdraw.Drawer from the vgpu package, which is provided by the goosi framework. It is akin to a window manager overlaying Go image bitmaps on top of each other in the proper order, based on the StageMgr stacking order.
- Sprites are managed by the Main Stage, as layered textures of the same size, to enable unlimited number packed into a few descriptors for standard sizes.
var CurRenderWin *RenderWin
CurRenderWin is the current RenderWin window. On single window platforms (mobile, web, and offscreen), this is the _only_ render window.
func NewRenderWin ¶
func NewRenderWin(name, title string, opts *goosi.NewWindowOptions) *RenderWin
NewRenderWin creates a new window with given internal name handle, display name, and options. This is called by Stage.NewRenderWin which handles setting the opts and other infrastructure.
func (*RenderWin) Close ¶
func (w *RenderWin) Close()
Close closes the window -- this is not a request -- it means: definitely close it -- flags window as such -- check Is(WinClosing)
func (*RenderWin) CloseReq ¶
func (w *RenderWin) CloseReq()
CloseReq requests that the window be closed -- could be rejected
func (*RenderWin) Closed ¶
func (w *RenderWin) Closed()
Closed frees any resources after the window has been closed.
func (*RenderWin) DrawScenes ¶
func (w *RenderWin) DrawScenes()
DrawScenes does the drawing of RenderScenes to the window.
func (*RenderWin) EventLoop ¶
func (w *RenderWin) EventLoop()
EventLoop runs the event processing loop for the RenderWin -- grabs goosi events for the window and dispatches them to receiving nodes, and manages other state etc (popups, etc).
func (*RenderWin) GatherScenes ¶
GatherScenes finds all the Scene elements that drive rendering into the RenderScenes list. Returns false on failure / nothing to render.
func (*RenderWin) GoStartEventLoop ¶
func (w *RenderWin) 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 (*RenderWin) HandleEvent ¶
HandleEvent processes given events.Event. All event processing operates under a RenderCtx.ReadLock so that no rendering update can occur during event-driven updates. Because rendering itself is event driven, this extra level of safety is redundant in this case, but other non-event-driven updates require the lock protection.
func (*RenderWin) HandleWindowEvents ¶
func (*RenderWin) IsVisible ¶
IsVisible is the main visibility check -- don't do any window updates if not visible!
func (*RenderWin) 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 (*RenderWin) MainScene ¶
MainScene returns the current MainStageMgr Top Scene, which is the current Window or FullWindow Dialog occupying the RenderWin.
func (*RenderWin) Minimize ¶
func (w *RenderWin) Minimize()
Minimize requests that the window be iconified, making it no longer visible or active -- rendering should not occur for minimized windows.
func (*RenderWin) Raise ¶
func (w *RenderWin) 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 (*RenderWin) RenderCtx ¶
func (w *RenderWin) RenderCtx() *RenderContext
func (*RenderWin) RenderWindow ¶
func (w *RenderWin) RenderWindow()
RenderWindow performs all rendering based on current StageMgr config. It sets the Write lock on RenderCtx Mutex, so nothing else can update during this time. All other updates are done with a Read lock so they won't interfere with each other.
func (*RenderWin) SendCustomEvent ¶
SendCustomEvent sends a custom event with given data to this window -- widgets can connect to receive CustomEventTypes 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 (*RenderWin) SendShowEvents ¶
func (w *RenderWin) SendShowEvents()
func (*RenderWin) SendWinFocusEvent ¶
func (w *RenderWin) SendWinFocusEvent(act events.WinActions)
todo: fix or remove SendWinFocusEvent sends the RenderWinFocusEvent to widgets
func (*RenderWin) SetCloseCleanFunc ¶
SetCloseCleanFunc sets the function that is called whenever window is actually about to close (irrevocably) -- can do any necessary last-minute cleanup here.
func (*RenderWin) SetCloseReqFunc ¶
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 (*RenderWin) SetName ¶
SetName sets name of this window and also the RenderWin, and applies any window geometry settings associated with the new name if it is different from before
func (*RenderWin) SetSize ¶
SetSize 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 (*RenderWin) SetWinSize ¶
SetWinSize 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 (*RenderWin) StartEventLoop ¶
func (w *RenderWin) 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 (*RenderWin) StopEventLoop ¶
func (w *RenderWin) StopEventLoop()
StopEventLoop tells the event loop to stop running when the next event arrives.
type RenderWinGeom ¶
RenderWinGeom records the geometry settings used for a given window
func (*RenderWinGeom) ConstrainGeom ¶
func (wg *RenderWinGeom) ConstrainGeom(sc *goosi.Screen)
ConstrainGeom constrains geometry based on screen params
func (*RenderWinGeom) Pos ¶
func (wg *RenderWinGeom) Pos() image.Point
func (*RenderWinGeom) SetPos ¶
func (wg *RenderWinGeom) SetPos(ps image.Point)
func (*RenderWinGeom) SetSize ¶
func (wg *RenderWinGeom) SetSize(sz image.Point)
func (*RenderWinGeom) Size ¶
func (wg *RenderWinGeom) Size() image.Point
type RenderWinList ¶
type RenderWinList []*RenderWin
RenderWinList is a list of windows.
var AllRenderWins RenderWinList
AllRenderWins is the list of all windows that have been created (dialogs, main windows, etc).
var DialogRenderWins RenderWinList
DialogRenderWins is the list of only dialog windows that have been created.
var MainRenderWins RenderWinList
MainRenderWins is the list of main windows (non-dialogs) that have been created.
func (*RenderWinList) Add ¶
func (wl *RenderWinList) Add(w *RenderWin)
Add adds a window to the list.
func (*RenderWinList) Delete ¶
func (wl *RenderWinList) Delete(w *RenderWin) bool
Delete removes a window from the list -- returns true if deleted.
func (*RenderWinList) FindData ¶
func (wl *RenderWinList) FindData(data any) (*RenderWin, 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 (*RenderWinList) FindName ¶
func (wl *RenderWinList) FindName(name string) (*RenderWin, bool)
FindName finds window with given name on list (case sensitive) -- returns window and true if found, nil, false otherwise.
func (*RenderWinList) FindRenderWin ¶
func (wl *RenderWinList) FindRenderWin(osw goosi.Window) (*RenderWin, bool)
FindRenderWin finds window with given goosi.RenderWin on list -- returns window and true if found, nil, false otherwise.
func (*RenderWinList) FocusNext ¶
func (wl *RenderWinList) FocusNext() (*RenderWin, int)
FocusNext focuses on the next window in the list, after the current Focused() one skips minimized windows
func (*RenderWinList) Focused ¶
func (wl *RenderWinList) Focused() (*RenderWin, int)
Focused returns the (first) window in this list that has the WinGotFocus flag set and the index in the list (nil, -1 if not present)
func (*RenderWinList) Len ¶
func (wl *RenderWinList) Len() int
Len returns the length of the list, concurrent-safe
func (*RenderWinList) Win ¶
func (wl *RenderWinList) Win(idx int) *RenderWin
Win gets window at given index, concurrent-safe
type SVG ¶
type SVG struct { WidgetBase // SVG is the SVG object associated with the element. SVG *svg.SVG `set:"-"` }
SVG is a Widget that renders an svg.SVG object. If not ReadOnly, the user can pan and zoom the display.
func NewSVG ¶
NewSVG adds a new SVG with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*SVG) ConfigToolbar ¶
func (*SVG) CopyFieldsFrom ¶
func (*SVG) DrawIntoScene ¶
func (sv *SVG) DrawIntoScene()
func (*SVG) HandleEvents ¶
func (sv *SVG) HandleEvents()
func (*SVG) SetCustomContextMenu ¶
SetCustomContextMenu sets the [SVG.CustomContextMenu]
type ScFlags ¶
type ScFlags WidgetFlags //enums:bitflag
ScFlags has critical state information signaling when rendering, styling etc need to be done
const ( // ScUpdating means scene is in the process of updating: // set for any kind of tree-level update. // skip any further update passes until it goes off. ScUpdating ScFlags = ScFlags(WidgetFlagsN) + iota // ScNeedsRender means nodes have flagged that they need a Render // update. ScNeedsRender // ScNeedsLayout means that this scene needs DoLayout stack: // GetSize, DoLayout, then Render. This is true after any Config. ScNeedsLayout // ScNeedsRebuild means that this scene needs full Rebuild: // Config, Layout, Render with DoRebuild flag set // (e.g., after global style changes, zooming, etc) ScNeedsRebuild // ScImageUpdated indicates that the Scene's image has been updated // e.g., due to a render or a resize. This is reset by the // global RenderWin rendering pass, so it knows whether it needs to // copy the image up to the GPU or not. ScImageUpdated // ScPrefSizing means that this scene is currently doing a // PrefSize computation to compute the size of the scene // (for sizing window for example) -- affects layout size computation // only for Over ScPrefSizing // ScPreserve keeps this scene around instead of deleting // when it is no longer needed. // Set if added to SceneLibrary for example. ScPreserve // ScRenderBBoxes renders the bounding boxes for all objects in scene ScRenderBBoxes )
const ScFlagsN ScFlags = 16
ScFlagsN is the highest valid value for type ScFlags, plus one.
func ScFlagsValues ¶
func ScFlagsValues() []ScFlags
ScFlagsValues returns all possible values for the type ScFlags.
func (ScFlags) BitIndexString ¶
BitIndexString returns the string representation of this ScFlags value if it is a bit index value (typically an enum constant), and not an actual bit flag value.
func (ScFlags) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*ScFlags) SetFlag ¶
SetFlag sets the value of the given flags in these flags to the given value.
func (*ScFlags) SetString ¶
SetString sets the ScFlags value from its string representation, and returns an error if the string is invalid.
func (*ScFlags) SetStringOr ¶
SetStringOr sets the ScFlags value from its string representation while preserving any bit flags already set, and returns an error if the string is invalid.
func (*ScFlags) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Scene ¶
type Scene struct { Frame // App is the pointer to the application to which this scene belongs. // The first Main Window Scene must set this, and others will automatically // grab from there. App *App // Bars contains functions for constructing the control bars for this Scene, // attached to different sides of a Scene (e.g., TopAppBar at Top, // NavBar at Bottom, etc). Functions are called in forward order // so first added are called first. Bars styles.Sides[BarFuncs] // BarsInherit determines which of the Bars side functions are inherited // from the context widget, for FullWindow Dialogs BarsInherit styles.Sides[bool] // AppBars contains functions for configuring a top-level App toolbar, // (e.g., TopAppBar) for elements contained within this Scene, // that should be represented in any app-level toolbar constructed // for this Scene. AppBars ToolbarFuncs // Body provides the main contents of scenes that use control Bars // to allow the main window contents to be specified separately // from that dynamic control content. When constructing scenes using // a Body, you can operate directly on the [Body], which has wrappers // for most major Scene functions. Body *Body // Data is the optional data value being represented by this scene. // Used e.g., for recycling views of a given item instead of creating new one. Data any // Size and position relative to overall rendering context. SceneGeom mat32.Geom2DInt `edit:"-" set:"-"` // paint context for rendering PaintContext paint.Context `copy:"-" json:"-" xml:"-" view:"-" set:"-"` // live pixels that we render into Pixels *image.RGBA `copy:"-" json:"-" xml:"-" view:"-" set:"-"` // Background for filling scene. // Defaults to nil so that popups can have rounded corners. Background image.Image // event manager for this scene EventMgr EventMgr `copy:"-" json:"-" xml:"-" set:"-"` // current stage in which this Scene is set Stage *Stage `copy:"-" json:"-" xml:"-" set:"-"` // RenderBBoxHue is current hue for rendering bounding box in ScRenderBBoxes mode RenderBBoxHue float32 `copy:"-" json:"-" xml:"-" view:"-" set:"-"` // the currently selected widget through the inspect editor selection mode SelectedWidget Widget // the channel on which the selected widget through the inspect editor // selection mode is transmitted to the inspect editor after the user is done selecting SelectedWidgetChan chan Widget // LastRender captures key params from last render. // If different then a new ApplyStyleScene is needed. LastRender RenderParams `edit:"-" set:"-"` // StyleMu is RW mutex protecting access to Style-related global vars StyleMu sync.RWMutex `copy:"-" json:"-" xml:"-" view:"-" set:"-"` // ShowIter counts up at start of showing a Scene // to trigger Show event and other steps at start of first show ShowIter int `copy:"-" json:"-" xml:"-" view:"-" set:"-"` // ReRender items are re-rendered after the current pass ReRender []Widget }
Scene contains a Widget tree, rooted in an embedded Frame layout, which renders into its Pixels image. The Scene is set in a Stage (pointer retained in Scene). Stage has a StageMgr manager for controlling things like Popups (Menus and Dialogs, etc).
Each Scene and Widget tree contains state specific to its particular usage within a given Stage and overall rendering context, representing the unit of rendering in the GoGi framework.
func AsScene ¶
func AsScene(k ki.Ki) *Scene
AsScene returns the given value as a value of type Scene if the type of the given value embeds Scene, or nil otherwise
func NewBodyScene ¶
NewBodyScene creates a new Scene for use with an associated Body that contains the main content of the Scene (e.g., a Window, Dialog, etc). It will be constructed from the Bars-configured control bars on each side, with the given Body as the central content.
func NewMenuFromStrings ¶
NewMenuFromStrings constructs a new menu from given list of strings, calling the given function with the index of the selected string. if string == sel, that menu item is selected initially.
func NewMenuScene ¶
NewMenuScene constructs a Scene for displaying a menu, using the given menu constructor function. If no name is provided, it defaults to "menu". If no menu items added, returns nil.
func NewScene ¶
NewScene creates a new Scene object without a Body, e.g., for use in a Menu, Tooltip or other such simple popups or non-control-bar Scenes.
func NewSnackbar ¶
NewSnackbar returns a new [Snackbar] Scene in the context of the given widget, optionally with the given name.
func NewTooltipScene ¶
NewTooltipScene returns a new tooltip scene for the given widget with the given tooltip based on the given context position and context size.
func (*Scene) AddCancel ¶
AddCancel adds Cancel button to given parent Widget (typically in Bottom Bar function), connecting to Close method and the Esc keychord event. Close sends a Change event to the Scene for listeners there. Should add an OnClick listener to this button to perform additional specific actions needed beyond Close. Name should be passed when there are multiple effective Cancel buttons (rare).
func (*Scene) AddOk ¶
AddOk adds an OK button to given parent Widget (typically in Bottom Bar function), connecting to Close method the Ctrl+Enter keychord event. Close sends a Change event to the Scene for listeners there. Should add an OnClick listener to this button to perform additional specific actions needed beyond Close. Name should be passed when there are multiple effective OK buttons.
func (*Scene) AddOkOnly ¶
AddOkOnly just adds an OK button in the BottomBar for simple popup dialogs that just need that one button
func (*Scene) AddReRender ¶
AddReRender adds given widget to be re-rendered next pass
func (*Scene) AddSnackbarButton ¶
AddSnackbarButton adds a button with the given text and optional OnClick event handler to the snackbar. Only the first of the given event handlers is used, and the popup is dismissed automatically regardless of whether there is an event handler passed.
func (*Scene) AddSnackbarIcon ¶
AddSnackbarIcon adds an icon button to the snackbar with the given icon and given OnClick event handler to the snackbar. Only the first of the given event handlers is used, and the popup is dismissed automatically regardless of whether there is an event handler passed.
func (*Scene) AddSnackbarText ¶
AddSnackbarText adds a label with the given text to a snackbar
func (*Scene) ApplyStyleScene ¶
func (sc *Scene) ApplyStyleScene()
ApplyStyleScene calls ApplyStyle on all widgets in the Scene, This is needed whenever the window geometry, DPI, etc is updated, which affects styling.
func (*Scene) AsScene ¶
AsScene satisfies the SceneEmbedder interface
func (*Scene) AssertPixels ¶
AssertPixels asserts that [Scene.Pixels] is equivalent to the image stored at the given filename in the testdata directory, with ".png" added to the filename if there is no extension (eg: "button" becomes "testdata/button.png"). If it is not, it fails the test with an error, but continues its execution. If there is no image at the given filename in the testdata directory, it creates the image.
func (*Scene) AssertPixelsOnShow ¶
AssertPixelsOnShow is a helper function that makes a new window from the scene, waits until it is shown, calls Scene.AssertPixels with the given values, and then closes the window. It does not return until all of those steps are completed. If a function is passed for the final argument, it is called after the scene is shown, right before Scene.AssertPixels is called. Also, if a function is passed, [Scene.DoNeedsRender] is also called before Scene.AssertPixels.
func (*Scene) BenchmarkFullRender ¶
func (sc *Scene) 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 (*Scene) BenchmarkReRender ¶
func (sc *Scene) 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 (*Scene) Close ¶
func (sc *Scene) Close()
Close closes the stage associated with this Scene (typically for Dialog)
func (*Scene) ConfigSceneBars ¶
func (sc *Scene) ConfigSceneBars()
ConfigSceneBars configures the side control bars, for main scenes
func (*Scene) ConfigSceneWidgets ¶
func (sc *Scene) ConfigSceneWidgets()
ConfigSceneWidgets calls Config on all widgets in the Scene, which will set NeedsLayout to drive subsequent layout and render. This is a top-level call, typically only done when the window is first drawn, once the full sizing information is available.
func (*Scene) Delete ¶
Delete this Scene if not Flagged for preservation. Removes Decor and Frame Widgets
func (*Scene) DeleteImpl ¶
func (sc *Scene) DeleteImpl()
DeleteImpl does the deletion, removing Decor and Frame Widgets.
func (*Scene) DeleteSnackbar ¶
func (sc *Scene) DeleteSnackbar()
DeleteSnackbar deletes the popup associated with the snackbar.
func (*Scene) DialogStyles ¶
func (sc *Scene) DialogStyles()
DialogStyles sets default style functions for dialog Scenes
func (*Scene) DoRebuild ¶
func (sc *Scene) DoRebuild()
DoRebuild does the full re-render and RenderContext Rebuild flag should be used by Widgets to rebuild things that are otherwise cached (e.g., Icon, TextCursor).
func (*Scene) DoUpdate ¶
DoUpdate checks scene Needs flags to do whatever updating is required. returns false if already updating. This is the main update call made by the RenderWin at FPS frequency.
func (*Scene) EncodePNG ¶
EncodePNG encodes the image as a PNG and writes it to the provided io.Writer.
func (*Scene) Fill ¶
func (sc *Scene) Fill()
Fill fills the scene with BgColor (default transparent) which is the starting base level for rendering. Typically the root Frame fills its background with color but it can e.g., leave corners transparent for popups etc.
func (*Scene) FitInWindow ¶
func (sc *Scene) FitInWindow(winGeom mat32.Geom2DInt)
FitInWindow fits Scene geometry (pos, size) into given window geom. Calls resize for the new size.
func (*Scene) FlagType ¶
func (sc *Scene) FlagType() enums.BitFlagSetter
func (*Scene) GetBar ¶
func (sc *Scene) GetBar(side styles.SideIndexes) *Layout
GetBar returns Bar layout widget at given side, nil if not there.
func (*Scene) GetTopAppBar ¶
GetTopAppBar returns the TopAppBar Toolbar if it exists, nil otherwise.
func (*Scene) InheritBars ¶
InheritBars inherits Bars functions from given other scene for each side that the other scene marks as inherited.
func (*Scene) InheritBarsWidget ¶
InheritBarsWidget inherits Bar functions based on a source widget (e.g., Context of dialog)
func (*Scene) LayoutRenderScene ¶
func (sc *Scene) LayoutRenderScene()
LayoutRenderScene does a layout and render of the tree: GetSize, DoLayout, Render. Needed after Config.
func (*Scene) LayoutScene ¶
func (sc *Scene) LayoutScene()
LayoutScene does a layout of the scene: Size, Position
func (*Scene) MainStageMgr ¶
MainStageMgr returns the Main StageMgr that typically lives in a RenderWin and manages all of the MainStage elements (Windows, Dialogs etc), which in turn manage their popups. This Scene could be in a popup or in a main stage.
func (*Scene) NewDialog ¶
NewDialog returns a new PopupWindow dialog Stage in the context of the given widget, optionally with the given name. See [NewFullDialog] for a full-window dialog.
func (*Scene) NewFullDialog ¶
NewFullDialog returns a new FullWindow dialog Stage in the context of the given widget, optionally with the given name. See [NewDialog] for a popup-window dialog.
func (*Scene) NewWindow ¶
NewWindow returns a new Window stage with given scene contents. Make further configuration choices using Set* methods, which can be chained directly after the New call. Use an appropriate Run call at the end to start the Stage running.
func (*Scene) PrefSize ¶
PrefSize computes the preferred size of the scene based on current contents. initSz is the initial size -- e.g., size of screen. Used for auto-sizing windows.
func (*Scene) RenderCtx ¶
func (sc *Scene) RenderCtx() *RenderContext
RenderCtx returns the current render context. This will be nil prior to actual rendering.
func (*Scene) RenderWin ¶
RenderWin returns the current render window for this scene. In general it is best to go through RenderCtx instead of the window. This will be nil prior to actual rendering.
func (*Scene) ReportWinNodes ¶
func (sc *Scene) ReportWinNodes()
ReportWinNodes reports the number of nodes in this scene
func (*Scene) ScIsVisible ¶
func (*Scene) SetApp ¶
SetApp sets the [Scene.App]: App is the pointer to the application to which this scene belongs. The first Main Window Scene must set this, and others will automatically grab from there.
func (*Scene) SetAppBars ¶
func (t *Scene) SetAppBars(v ToolbarFuncs) *Scene
SetAppBars sets the [Scene.AppBars]: AppBars contains functions for configuring a top-level App toolbar, (e.g., TopAppBar) for elements contained within this Scene, that should be represented in any app-level toolbar constructed for this Scene.
func (*Scene) SetBackground ¶
SetBackground sets the [Scene.Background]: Background for filling scene. Defaults to nil so that popups can have rounded corners.
func (*Scene) SetBars ¶
SetBars sets the [Scene.Bars]: Bars contains functions for constructing the control bars for this Scene, attached to different sides of a Scene (e.g., TopAppBar at Top, NavBar at Bottom, etc). Functions are called in forward order so first added are called first.
func (*Scene) SetBarsInherit ¶
SetBarsInherit sets the [Scene.BarsInherit]: BarsInherit determines which of the Bars side functions are inherited from the context widget, for FullWindow Dialogs
func (*Scene) SetBody ¶
SetBody sets the [Scene.Body]: Body provides the main contents of scenes that use control Bars to allow the main window contents to be specified separately from that dynamic control content. When constructing scenes using a Body, you can operate directly on the Body, which has wrappers for most major Scene functions.
func (*Scene) SetCustomContextMenu ¶
SetCustomContextMenu sets the [Scene.CustomContextMenu]
func (*Scene) SetData ¶
SetData sets the [Scene.Data]: Data is the optional data value being represented by this scene. Used e.g., for recycling views of a given item instead of creating new one.
func (*Scene) SetReRender ¶
SetReRender sets the [Scene.ReRender]: ReRender items are re-rendered after the current pass
func (*Scene) SetSelectedWidget ¶
SetSelectedWidget sets the [Scene.SelectedWidget]: the currently selected widget through the inspect editor selection mode
func (*Scene) SetSelectedWidgetChan ¶
SetSelectedWidgetChan sets the [Scene.SelectedWidgetChan]: the channel on which the selected widget through the inspect editor selection mode is transmitted to the inspect editor after the user is done selecting
func (*Scene) SetStackTop ¶
SetStackTop sets the [Scene.StackTop]
func (*Scene) SetStripes ¶
SetStripes sets the [Scene.Stripes]
func (*Scene) SetTooltip ¶
SetTooltip sets the [Scene.Tooltip]
func (*Scene) SnackbarStyles ¶
func (sc *Scene) SnackbarStyles()
type SceneEmbedder ¶
type SceneEmbedder interface {
AsScene() *Scene
}
SceneEmbedder is an interface that all types that embed Scene satisfy
type ScreenPrefs ¶
type ScreenPrefs struct { // overall zoom factor as a percentage of the default zoom Zoom float32 `def:"100" min:"10" max:"1000" step:"10"` }
ScreenPrefs are the per-screen preferences -- see goosi/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 Separator ¶
type Separator struct { Box // Dim is the dimension the separator goes along (X means it goes longer horizontally, etc) Dim mat32.Dims }
Separator draws a vertical or horizontal line
func NewSeparator ¶
NewSeparator adds a new Separator with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*Separator) CopyFieldsFrom ¶
func (*Separator) SetCustomContextMenu ¶
SetCustomContextMenu sets the [Separator.CustomContextMenu]
func (*Separator) SetDim ¶
SetDim sets the [Separator.Dim]: Dim is the dimension the separator goes along (X means it goes longer horizontally, etc)
func (*Separator) SetTooltip ¶
SetTooltip sets the [Separator.Tooltip]
type Settings ¶
type Settings interface { // Filename returns the full filename/filepath at which the settings are stored. Filename() string // Defaults sets the default values for all of the settings. Defaults() // Apply does anything necessary to apply the settings to the app. Apply() }
Settings is the interface that describes the functionality common to all settings data types.
type SettingsBase ¶
type SettingsBase struct { // File is the full filename/filepath at which the settings are stored. File string `view:"-"` }
SettingsBase contains base settings logic that other settings data types can extend.
func (*SettingsBase) Apply ¶
func (sb *SettingsBase) Apply()
Apply does nothing by default and can be extended by other settings data types.
func (*SettingsBase) Defaults ¶
func (sb *SettingsBase) Defaults()
Defaults does nothing by default and can be extended by other settings data types.
func (*SettingsBase) Filename ¶
func (sb *SettingsBase) Filename() string
Filename returns the full filename/filepath at which the settings are stored.
type Shortcuts ¶
Shortcuts is a map between a key chord and a specific Button that can be triggered. This mapping must be unique, in that each chord has unique Button, and generally each Button 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 buttons. Widget-specific key functions should be handled directly within widget key event processing.
type SliceLabeler ¶
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 { WidgetBase // the type of the slider, which determines the visual and functional properties Type SliderTypes `set:"-"` // Current value, represented by the position of the thumb. Value float32 `set:"-"` // dimension along which the slider slides Dim mat32.Dims // minimum value in range Min float32 // maximum value in range Max float32 // smallest step size to increment Step float32 // larger PageUp / Dn step size PageStep float32 // For Scrollbar type only: proportion (1 max) of the full range of scrolled data // that is currently visible. This determines the thumb size and range of motion: // if 1, full slider is the thumb and no motion is possible. VisiblePct float32 `set:"-"` // Size of the thumb as a proportion of the slider thickness, which is // Content size (inside the padding). This is for actual X,Y dimensions, // so must be sensitive to Dim dimension alignment. ThumbSize mat32.Vec2 // TrackSize is the proportion of slider thickness for the visible track // for the Slider type. It is often thinner than the thumb, achieved by // values < 1 (.5 default) TrackSize float32 // optional icon for the dragging knob Icon icons.Icon `view:"show-name"` // threshold for amount of change in scroll value before emitting an input event InputThreshold float32 // whether to snap the values to Step size increments Snap bool // specifies the precision of decimal places (total, not after the decimal point) // to use in representing the number. This helps to truncate small weird floating // point values in the nether regions. Prec int // The background color that is used for styling the selected value section of the slider. // It should be set in the StyleFuncs, just like the main style object is. // If it is set to transparent, no value is rendered, so the value section of the slider // just looks like the rest of the slider. ValueColor image.Image // The background color that is used for styling the thumb (handle) of the slider. // It should be set in the StyleFuncs, just like the main style object is. // If it is set to transparent, no thumb is rendered, so the thumb section of the slider // just looks like the rest of the slider. ThumbColor image.Image // If true, keep the slider (typically a Scrollbar) within the parent Scene // bounding box, if the parent is in view. This is the default behavior // for Layout scrollbars, and setting this flag replicates that behavior // in other scrollbars. StayInView bool // logical position of the slider relative to Size Pos float32 `edit:"-" set:"-"` // previous Change event emitted value - don't re-emit Change if it is the same LastValue float32 `edit:"-" copy:"-" xml:"-" json:"-" set:"-"` // previous sliding value - for computing the Input change PrevSlide float32 `edit:"-" copy:"-" xml:"-" json:"-" set:"-"` // Computed size of the slide box in the relevant dimension // range of motion, exclusive of spacing, based on layout allocation. Size float32 `edit:"-" set:"-"` // underlying drag position of slider -- not subject to snapping SlideStartPos float32 `edit:"-" set:"-"` }
Slider is a slideable widget that provides slider functionality for two Types: Slider type provides a movable thumb that represents Value as the center of thumb Pos position, with room reserved at ends for 1/2 of the thumb size. Scrollbar has a VisiblePct factor that specifies the percent of the content currently visible, which determines the size of the thumb, and thus the range of motion remaining for the thumb Value (VisiblePct = 1 means thumb is full size, and no remaining range of motion). The Content size (inside the margin and padding) determines the outer bounds of the rendered area.
func AsSlider ¶
func AsSlider(k ki.Ki) *Slider
AsSlider returns the given value as a value of type Slider if the type of the given value embeds Slider, or nil otherwise
func NewSlider ¶
NewSlider adds a new Slider with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*Slider) AsSlider ¶
AsSlider satisfies the SliderEmbedder interface
func (*Slider) ConfigParts ¶
func (sr *Slider) ConfigParts()
func (*Slider) ConfigSlider ¶
func (sr *Slider) ConfigSlider()
func (*Slider) ConfigWidget ¶
func (sr *Slider) ConfigWidget()
func (*Slider) CopyFieldsFrom ¶
func (*Slider) EffectiveMax ¶
EffectiveMax returns the effective maximum value represented. For the Slider type, it it is just Max. for the Scrollbar type, it is Max - Value of thumb size
func (*Slider) HandleEvents ¶
func (sr *Slider) HandleEvents()
func (*Slider) HandleKeys ¶
func (sr *Slider) HandleKeys()
func (*Slider) HandleMouse ¶
func (sr *Slider) HandleMouse()
func (*Slider) PointToRelPos ¶
PointToRelPos translates a point in scene local pixel coords into relative position within the slider content range
func (*Slider) RenderSlider ¶
func (sr *Slider) RenderSlider()
func (*Slider) ScrollThumbValue ¶
ScrollThumbValue returns the current scroll VisiblePct in terms of the Min - Max range of values.
func (*Slider) SendChanged ¶
SendChanged sends a Changed message if given new value is different from the existing Value.
func (*Slider) SetCustomContextMenu ¶
SetCustomContextMenu sets the [Slider.CustomContextMenu]
func (*Slider) SetInputThreshold ¶
SetInputThreshold sets the [Slider.InputThreshold]: threshold for amount of change in scroll value before emitting an input event
func (*Slider) SetPageStep ¶
SetPageStep sets the [Slider.PageStep]: larger PageUp / Dn step size
func (*Slider) SetPosFromValue ¶
SetPosFromValue sets the slider position based on the given value (typically rs.Value)
func (*Slider) SetPrec ¶
SetPrec sets the [Slider.Prec]: specifies the precision of decimal places (total, not after the decimal point) to use in representing the number. This helps to truncate small weird floating point values in the nether regions.
func (*Slider) SetSliderPos ¶
SetSliderPos sets the position of the slider at the given relative position within the usable Content sliding range, in pixels, and updates the corresponding Value based on that position.
func (*Slider) SetSliderPosAction ¶
SetSliderPosAction sets the position of the slider at the given position in pixels, and updates the corresponding Value based on that position. This version sends tracking changes
func (*Slider) SetSnap ¶
SetSnap sets the [Slider.Snap]: whether to snap the values to Step size increments
func (*Slider) SetStayInView ¶
SetStayInView sets the [Slider.StayInView]: If true, keep the slider (typically a Scrollbar) within the parent Scene bounding box, if the parent is in view. This is the default behavior for Layout scrollbars, and setting this flag replicates that behavior in other scrollbars.
func (*Slider) SetThumbColor ¶
SetThumbColor sets the [Slider.ThumbColor]: The background color that is used for styling the thumb (handle) of the slider. It should be set in the StyleFuncs, just like the main style object is. If it is set to transparent, no thumb is rendered, so the thumb section of the slider just looks like the rest of the slider.
func (*Slider) SetThumbSize ¶
SetThumbSize sets the [Slider.ThumbSize]: Size of the thumb as a proportion of the slider thickness, which is Content size (inside the padding). This is for actual X,Y dimensions, so must be sensitive to Dim dimension alignment.
func (*Slider) SetTooltip ¶
SetTooltip sets the [Slider.Tooltip]
func (*Slider) SetTrackSize ¶
SetTrackSize sets the [Slider.TrackSize]: TrackSize is the proportion of slider thickness for the visible track for the Slider type. It is often thinner than the thumb, achieved by values < 1 (.5 default)
func (*Slider) SetType ¶
func (sr *Slider) SetType(typ SliderTypes) *Slider
SetType sets the type of the slider
func (*Slider) SetValue ¶
SetValue sets the value and updates the slider position, but does not send a Change event (see Action version)
func (*Slider) SetValueAction ¶
SetValueAction sets the value and updates the slider representation, and emits an input and change event
func (*Slider) SetValueColor ¶
SetValueColor sets the [Slider.ValueColor]: The background color that is used for styling the selected value section of the slider. It should be set in the StyleFuncs, just like the main style object is. If it is set to transparent, no value is rendered, so the value section of the slider just looks like the rest of the slider.
func (*Slider) SetVisiblePct ¶
SetVisiblePct sets the visible pct value for Scrollbar type.
func (*Slider) SlideThumbSize ¶
SlideThumbSize returns thumb size, based on type
func (*Slider) SliderSize ¶
SliderSize returns the size available for sliding, based on allocation
func (*Slider) SliderThickness ¶
SliderThickness returns the thickness of the slider: Content size in other dim.
func (*Slider) SnapValue ¶
func (sr *Slider) SnapValue()
SnapValue snaps the value to step sizes if snap option is set
func (*Slider) ThumbSizeDots ¶
func (sr *Slider) ThumbSizeDots() mat32.Vec2
ThumbSizeDots returns the thumb size in dots, based on ThumbSize and the content thickness
type SliderEmbedder ¶
type SliderEmbedder interface {
AsSlider() *Slider
}
SliderEmbedder is an interface that all types that embed Slider satisfy
type SliderTypes ¶
type SliderTypes int32 //enums:enum -trimprefix Slider
SliderTypes are the different types of sliders
const ( // SliderSlider indicates a standard, user-controllable slider // for setting a numeric value SliderSlider SliderTypes = iota // SliderScrollbar indicates a slider acting as a scrollbar for content // This sets the SliderScrollbar )
const SliderTypesN SliderTypes = 2
SliderTypesN is the highest valid value for type SliderTypes, plus one.
func SliderTypesValues ¶
func SliderTypesValues() []SliderTypes
SliderTypesValues returns all possible values for the type SliderTypes.
func (SliderTypes) Desc ¶
func (i SliderTypes) Desc() string
Desc returns the description of the SliderTypes value.
func (SliderTypes) Int64 ¶
func (i SliderTypes) Int64() int64
Int64 returns the SliderTypes value as an int64.
func (SliderTypes) IsValid ¶
func (i SliderTypes) IsValid() bool
IsValid returns whether the value is a valid option for type SliderTypes.
func (SliderTypes) MarshalText ¶
func (i SliderTypes) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (*SliderTypes) SetInt64 ¶
func (i *SliderTypes) SetInt64(in int64)
SetInt64 sets the SliderTypes value from an int64.
func (*SliderTypes) SetString ¶
func (i *SliderTypes) SetString(s string) error
SetString sets the SliderTypes value from its string representation, and returns an error if the string is invalid.
func (SliderTypes) String ¶
func (i SliderTypes) String() string
String returns the string representation of this SliderTypes value.
func (*SliderTypes) UnmarshalText ¶
func (i *SliderTypes) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (SliderTypes) Values ¶
func (i SliderTypes) Values() []enums.Enum
Values returns all possible values for the type SliderTypes.
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 NewSpace ¶
NewSpace adds a new Space with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*Space) CopyFieldsFrom ¶
func (*Space) SetCustomContextMenu ¶
SetCustomContextMenu sets the [Space.CustomContextMenu]
func (*Space) SetTooltip ¶
SetTooltip sets the [Space.Tooltip]
type Spell ¶
type Spell struct { // line number in source that spelling is operating on, if relevant SrcLn int // character position in source that spelling is operating on (start of word to be corrected) SrcCh int // list of suggested corrections Suggest []string // word being checked Word string `set:"-"` // last word learned -- can be undone -- stored in lowercase format LastLearned string `set:"-"` // the user's correction selection Correction string `set:"-"` // the event listeners for the spell (it sends Select events) Listeners events.Listeners `set:"-" view:"-"` // Stage is the [PopupStage] associated with the [Spell] Stage *Stage ShowMu sync.Mutex `set:"-"` }
Spell
func (*Spell) Cancel ¶
Cancel cancels any pending spell correction. call when new events nullify prior correction. returns true if canceled
func (*Spell) CheckWord ¶
CheckWord checks the model to determine if the word is known. automatically checks the Ignore list first.
func (*Spell) IgnoreWord ¶
func (sp *Spell) IgnoreWord()
IgnoreWord adds the word to the ignore list
func (*Spell) IsLastLearned ¶
IsLastLearned returns true if given word was the last one learned
func (*Spell) LearnWord ¶
func (sp *Spell) LearnWord()
LearnWord gets the misspelled/unknown word and passes to LearnWord
func (*Spell) OnSelect ¶
OnSelect registers given listener function for Select events on Value. This is the primary notification event for all Complete elements.
func (*Spell) SetSrcCh ¶
SetSrcCh sets the [Spell.SrcCh]: character position in source that spelling is operating on (start of word to be corrected)
func (*Spell) SetSrcLn ¶
SetSrcLn sets the [Spell.SrcLn]: line number in source that spelling is operating on, if relevant
func (*Spell) SetStage ¶
SetStage sets the [Spell.Stage]: Stage is the [PopupStage] associated with the Spell
func (*Spell) SetSuggest ¶
SetSuggest sets the [Spell.Suggest]: list of suggested corrections
func (*Spell) Show ¶
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) Spell ¶
Spell sends a Select event to Listeners indicating that the user has made a selection from the list of possible corrections
func (*Spell) UnLearnLast ¶
func (sp *Spell) UnLearnLast()
UnLearnLast unlearns the last learned word -- in case accidental
type SpellSignals ¶
type SpellSignals int32 //enums:enum -trim-prefix Spell
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 )
const SpellSignalsN SpellSignals = 2
SpellSignalsN is the highest valid value for type SpellSignals, plus one.
func SpellSignalsValues ¶
func SpellSignalsValues() []SpellSignals
SpellSignalsValues returns all possible values for the type SpellSignals.
func (SpellSignals) Desc ¶
func (i SpellSignals) Desc() string
Desc returns the description of the SpellSignals value.
func (SpellSignals) Int64 ¶
func (i SpellSignals) Int64() int64
Int64 returns the SpellSignals value as an int64.
func (SpellSignals) IsValid ¶
func (i SpellSignals) IsValid() bool
IsValid returns whether the value is a valid option for type SpellSignals.
func (SpellSignals) MarshalText ¶
func (i SpellSignals) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (*SpellSignals) SetInt64 ¶
func (i *SpellSignals) SetInt64(in int64)
SetInt64 sets the SpellSignals value from an int64.
func (*SpellSignals) SetString ¶
func (i *SpellSignals) SetString(s string) error
SetString sets the SpellSignals value from its string representation, and returns an error if the string is invalid.
func (SpellSignals) String ¶
func (i SpellSignals) String() string
String returns the string representation of this SpellSignals value.
func (*SpellSignals) UnmarshalText ¶
func (i *SpellSignals) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (SpellSignals) Values ¶
func (i SpellSignals) Values() []enums.Enum
Values returns all possible values for the type SpellSignals.
type Spinner ¶
type Spinner struct { TextField // current value Value float32 `xml:"value" set:"-"` // is there a minimum value to enforce HasMin bool `xml:"has-min" set:"-"` // minimum value in range Min float32 `xml:"min" set:"-"` // is there a maximumvalue to enforce HasMax bool `xml:"has-max" set:"-"` // maximum value in range Max float32 `xml:"max" set:"-"` // smallest step size to increment Step float32 `xml:"step"` // larger PageUp / Dn step size PageStep float32 `xml:"pagestep"` // specifies the precision of decimal places (total, not after the decimal point) to use in representing the number -- this helps to truncate small weird floating point values in the nether regions Prec int // prop = format -- format string for printing the value -- blank defaults to %g. If decimal based (ends in d, b, c, o, O, q, x, X, or U) then value is converted to decimal prior to printing Format string `xml:"format"` }
Spinner combines a TextField with up / down buttons for incrementing / decrementing values -- all configured within the Parts of the widget
func AsSpinner ¶
func AsSpinner(k ki.Ki) *Spinner
AsSpinner returns the given value as a value of type Spinner if the type of the given value embeds Spinner, or nil otherwise
func NewSpinner ¶
NewSpinner adds a new Spinner with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*Spinner) AsSpinner ¶
AsSpinner satisfies the SpinnerEmbedder interface
func (*Spinner) CopyFieldsFrom ¶
func (*Spinner) FormatIsInt ¶
FormatIsInt returns true if the format string requires an integer value
func (*Spinner) HandleEvents ¶
func (sp *Spinner) HandleEvents()
func (*Spinner) HandleKeys ¶
func (sp *Spinner) HandleKeys()
func (*Spinner) 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 (*Spinner) PageIncrValue ¶
PageIncrValue increments the value by given number of page steps (+ or -), and enforces it to be an even multiple of the step size (snap-to-value), and emits the signal
func (*Spinner) SetComplete ¶
SetComplete sets the [Spinner.Complete]
func (*Spinner) SetCursorColor ¶
SetCursorColor sets the [Spinner.CursorColor]
func (*Spinner) SetCursorWidth ¶
SetCursorWidth sets the [Spinner.CursorWidth]
func (*Spinner) SetCustomContextMenu ¶
SetCustomContextMenu sets the [Spinner.CustomContextMenu]
func (*Spinner) SetFormat ¶
SetFormat sets the [Spinner.Format]: prop = format -- format string for printing the value -- blank defaults to %g. If decimal based (ends in d, b, c, o, O, q, x, X, or U) then value is converted to decimal prior to printing
func (*Spinner) SetLeadingIconOnClick ¶
SetLeadingIconOnClick sets the [Spinner.LeadingIconOnClick]
func (*Spinner) SetMaxWidthReq ¶
SetMaxWidthReq sets the [Spinner.MaxWidthReq]
func (*Spinner) SetPageStep ¶
SetPageStep sets the [Spinner.PageStep]: larger PageUp / Dn step size
func (*Spinner) SetPlaceholder ¶
SetPlaceholder sets the [Spinner.Placeholder]
func (*Spinner) SetPlaceholderColor ¶
SetPlaceholderColor sets the [Spinner.PlaceholderColor]
func (*Spinner) SetPrec ¶
SetPrec sets the [Spinner.Prec]: specifies the precision of decimal places (total, not after the decimal point) to use in representing the number -- this helps to truncate small weird floating point values in the nether regions
func (*Spinner) SetSelectColor ¶
SetSelectColor sets the [Spinner.SelectColor]
func (*Spinner) SetSelectMode ¶
SetSelectMode sets the [Spinner.SelectMode]
func (*Spinner) SetTextToValue ¶
func (sp *Spinner) SetTextToValue()
func (*Spinner) SetTooltip ¶
SetTooltip sets the [Spinner.Tooltip]
func (*Spinner) SetTrailingIconOnClick ¶
SetTrailingIconOnClick sets the [Spinner.TrailingIconOnClick]
func (*Spinner) SetType ¶
func (t *Spinner) SetType(v TextFieldTypes) *Spinner
SetType sets the [Spinner.Type]
func (*Spinner) SetValueAction ¶
SetValueAction calls SetValue and also emits the signal
func (*Spinner) StringToVal ¶
StringToVal converts the string field back to float value
func (*Spinner) ValToString ¶
ValToString converts the value to the string representation thereof
type SpinnerEmbedder ¶
type SpinnerEmbedder interface {
AsSpinner() *Spinner
}
SpinnerEmbedder is an interface that all types that embed Spinner satisfy
type Splits ¶
type Splits struct { Layout // dimension along which to split the space Dim mat32.Dims // proportion (0-1 normalized, enforced) of space allocated to each element. // Enter 0 to collapse a given element Splits []float32 `set:"-"` // A saved version of the splits which can be restored. // For dynamic collapse / expand operations SavedSplits []float32 `set:"-"` }
Splits allocates a fixed proportion of space to each child, along given dimension. It uses the Widget Parts to hold the Handle widgets separately from the children that contain the rest of the scene to be displayed within each panel.
func AsSplits ¶
func AsSplits(k ki.Ki) *Splits
AsSplits returns the given value as a value of type Splits if the type of the given value embeds Splits, or nil otherwise
func NewSplits ¶
NewSplits adds a new Splits with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*Splits) ApplyStyle ¶
func (sl *Splits) ApplyStyle()
func (*Splits) AsSplits ¶
AsSplits satisfies the SplitsEmbedder interface
func (*Splits) 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 (*Splits) ConfigSplitters ¶
func (sl *Splits) ConfigSplitters()
func (*Splits) ConfigWidget ¶
func (sl *Splits) ConfigWidget()
func (*Splits) CopyFieldsFrom ¶
func (*Splits) EvenSplits ¶
func (sl *Splits) EvenSplits()
EvenSplits splits space evenly across all panels
func (*Splits) HandleEvents ¶
func (sl *Splits) HandleEvents()
func (*Splits) IsCollapsed ¶
IsCollapsed returns true if given split number is collapsed
func (*Splits) PositionSplits ¶
func (sl *Splits) PositionSplits()
func (*Splits) RestoreChild ¶
RestoreChild restores given child(ren) -- does an Update
func (*Splits) RestoreSplits ¶
func (sl *Splits) RestoreSplits()
RestoreSplits restores a previously-saved set of splits (if it exists), does an update
func (*Splits) SaveSplits ¶
func (sl *Splits) SaveSplits()
SaveSplits saves the current set of splits in SavedSplits, for a later RestoreSplits
func (*Splits) SetCustomContextMenu ¶
SetCustomContextMenu sets the [Splits.CustomContextMenu]
func (*Splits) 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 (*Splits) SetSplits ¶
SetSplits sets the split proportions -- can use 0 to hide / collapse a child entirely.
func (*Splits) SetSplitsAction ¶
SetSplitsAction sets the split proportions -- can use 0 to hide / collapse a child entirely -- does full rebuild at level of scene
func (*Splits) SetSplitsList ¶
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 (*Splits) SetStackTop ¶
SetStackTop sets the [Splits.StackTop]
func (*Splits) SetTooltip ¶
SetTooltip sets the [Splits.Tooltip]
func (*Splits) SizeDownSetAllocs ¶
func (*Splits) UpdateSplits ¶
func (sl *Splits) UpdateSplits()
UpdateSplits updates the splits to be same length as number of children, and normalized
type SplitsEmbedder ¶
type SplitsEmbedder interface {
AsSplits() *Splits
}
SplitsEmbedder is an interface that all types that embed Splits satisfy
type Sprite ¶
type Sprite struct { // whether this sprite is active now or not On bool // unique name of sprite Name string // properties for sprite -- allows user-extensible data Props ki.Props // position and size of the image within the overlay window texture Geom mat32.Geom2DInt // pixels to render -- should be same size as Geom.Size Pixels *image.RGBA }
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 ¶
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) GrabRenderFrom ¶
GrabRenderFrom grabs the rendered image from given node
func (*Sprite) SetBottomPos ¶
SetBottomPos sets the sprite's bottom position to given point the Geom.Pos represents its top position
type Sprites ¶
type Sprites struct { // map of uniquely named sprites Names ordmap.Map[string, *Sprite] // allocation of sprites by size for rendering SzAlloc szalloc.SzAlloc // set to true if sprites have been modified since last config Modified bool // number of active sprites Active int }
Sprites manages a collection of sprites organized by size and name
func (*Sprites) ActivateSprite ¶
ActivateSprite flags the sprite as active, setting Modified if wasn't before
func (*Sprites) Add ¶
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 ¶
func (ss *Sprites) AllocSizes()
AllocSizes allocates the sprites by size to fixed set of images and layers
func (*Sprites) ConfigSprites ¶
ConfigSprites updates the Drawer configuration of sprites. Does a new SzAlloc, and sets corresponding images.
func (*Sprites) Delete ¶
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) DrawSprites ¶
DrawSprites draws sprites
func (*Sprites) HasSizeChanged ¶
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.
func (*Sprites) InactivateAllSprites ¶
func (ss *Sprites) InactivateAllSprites()
InactivateAllSprites inactivates all sprites, setting Modified if wasn't before
func (*Sprites) InactivateSprite ¶
InactivateSprite flags the sprite as inactive, setting Modified if wasn't before
type Stage ¶
type Stage struct { // type of Stage: determines behavior and Styling Type StageTypes `set:"-"` // Scene contents of this Stage -- what it displays Scene *Scene `set:"-"` // widget in another scene that requested this stage to be created // and provides context (stage) Context Widget // name of the Stage -- generally auto-set based on Scene Name Name string // Title of the Stage -- generally auto-set based on Scene Title. // Used for title of Window and Dialog types. Title string // if true, blocks input to all other stages. Modal bool // if true, places a darkening scrim over other stages, if not a full window Scrim bool // if true dismisses the Stage if user clicks anywhere off the Stage ClickOff bool // whether to send no events to the stage and just pass them down to lower stages IgnoreEvents bool // NewWindow: if true, opens a Window or Dialog in its own separate operating // system window (RenderWin). This is by default true for Window on Desktop, otherwise false. NewWindow bool // if NewWindow is false, then this makes Dialogs and Windows take up // the entire window they are created in. FullWindow bool // for Dialogs: if true includes a close button for closing Closeable bool // for Dialogs: adds a handle titlebar Decor for moving Movable bool // for Dialogs: adds a resize handle Decor for resizing Resizable bool // Target position for Scene to be placed within RenderWin Pos image.Point // Side for Stages that can operate on different sides, e.g., // for Sheets: which side does the sheet come out from Side StageSides // Data is item represented by this main stage -- used for recycling windows Data any // If a Popup Stage, this is the Main Stage that owns it (via its PopupMgr) // If a Main Stage, it points to itself. Main *Stage // For Main stages, this is the manager for the popups within it (created // specifically for the main stage). // For Popups, this is the pointer to the PopupMgr within the // Main Stage managing it. PopupMgr *StageMgr `set:"-"` // For all stages, this is the Main stage manager that lives in a RenderWin // and manages the Main Scenes. MainMgr *StageMgr `set:"-"` // rendering context which has info about the RenderWin onto which we render. // This should be used instead of the RenderWin itself for all relevant // rendering information. This is only available once a Stage is Run, // and must always be checked for nil. RenderCtx *RenderContext // sprites are named images that are rendered last overlaying everything else. Sprites Sprites `json:"-" xml:"-"` // name of sprite that is being dragged -- sprite event function is responsible for setting this. SpriteDragging string `json:"-" xml:"-"` // if > 0, disappears after a timeout duration Timeout time.Duration }
Stage is a container and manager for displaying a Scene in different functional ways, defined by StageTypes, in two categories: Main types (Window, Dialog, Sheet) and Popup types (Menu, Tooltip, Snackbar, Chooser).
func NewCompleter ¶
NewCompleter returns a new CompleterStage with given scene contents, in connection with given widget (which provides key context). Make further configuration choices using Set* methods, which can be chained directly after the New call. Use an appropriate Run call at the end to start the Stage running.
func NewMainStage ¶
func NewMainStage(typ StageTypes, sc *Scene) *Stage
NewMainStage returns a new MainStage with given type and scene contents. Make further configuration choices using Set* methods, which can be chained directly after the NewMainStage call. Use an appropriate Run call at the end to start the Stage running.
func NewMenu ¶
NewMenu returns a new menu stage based on the given menu constructor function, in connection with given widget, which provides key context for constructing the menu at given RenderWin position (e.g., use ContextMenuPos or WinPos method on ctx Widget). Make further configuration choices using Set* methods, which can be chained directly after the New call. Use Run call at the end to start the Stage running.
func NewMenuStage ¶
NewMenuStage returns a new Menu stage with given scene contents, in connection with given widget, which provides key context for constructing the menu, at given RenderWin position (e.g., use ContextMenuPos or WinPos method on ctx Widget). Make further configuration choices using Set* methods, which can be chained directly after the New call. Use Run call at the end to start the Stage running.
func NewPopupStage ¶
func NewPopupStage(typ StageTypes, sc *Scene, ctx Widget) *Stage
NewPopupStage returns a new PopupStage with given type and scene contents. The given context widget must be non-nil. Make further configuration choices using Set* methods, which can be chained directly after the NewPopupStage call. Use Run call at the end to start the Stage running.
func NewSheet ¶
func NewSheet(sc *Scene, side StageSides) *Stage
NewSheet returns a new Sheet stage with given scene contents, in connection with given widget (which provides key context). for given side (e.g., Bottom or LeftSide). Make further configuration choices using Set* methods, which can be chained directly after the New call. Use an appropriate Run call at the end to start the Stage running.
func NewTooltip ¶
NewTooltip returns a new tooltip stage displaying the tooltip text for the given widget based on the widget's position and size.
func NewTooltipFromScene ¶
NewTooltipFromScene returns a new Tooltip stage with given scene contents, in connection with given widget (which provides key context). Make further configuration choices using Set* methods, which can be chained directly after the New call. Use an appropriate Run call at the end to start the Stage running.
func NewTooltipText ¶
NewTooltipText returns a new tooltip stage displaying the given tooltip text for the given widget based on the widget's position and size.
func NewTooltipTextAt ¶
NewTooltipTextAt returns a new tooltip stage displaying the given tooltip text for the given widget at the given position with the given size.
func (*Stage) AddDialogDecor ¶
func (*Stage) AddSheetDecor ¶
func (*Stage) ConfigMainStage ¶
func (st *Stage) ConfigMainStage()
ConfigMainStage does main-stage configuration steps
func (*Stage) DoUpdate ¶
DoUpdate calls DoUpdate on our Scene and UpdateAll on our Popups for Main types. returns stageMods = true if any Popup Stages have been modified and sceneMods = true if any Scenes have been modified.
func (*Stage) FirstWinManager ¶
FirstWinManager creates a temporary Main StageMgr for the first window to be able to get sizing information prior to having a RenderWin, based on the goosi App Screen Size. Only adds a RenderCtx.
func (*Stage) InheritBars ¶
func (st *Stage) InheritBars()
func (*Stage) MainHandleEvent ¶
MainHandleEvent handles main stage events
func (*Stage) NewRenderWin ¶
func (*Stage) PopupHandleEvent ¶
func (*Stage) SetClickOff ¶
SetClickOff sets the [Stage.ClickOff]: if true dismisses the Stage if user clicks anywhere off the Stage
func (*Stage) SetCloseable ¶
SetCloseable sets the [Stage.Closeable]: for Dialogs: if true includes a close button for closing
func (*Stage) SetContext ¶
SetContext sets the [Stage.Context]: widget in another scene that requested this stage to be created and provides context (stage)
func (*Stage) SetData ¶
SetData sets the [Stage.Data]: Data is item represented by this main stage -- used for recycling windows
func (*Stage) SetFullWindow ¶
SetFullWindow sets the [Stage.FullWindow]: if NewWindow is false, then this makes Dialogs and Windows take up the entire window they are created in.
func (*Stage) SetIgnoreEvents ¶
SetIgnoreEvents sets the [Stage.IgnoreEvents]: whether to send no events to the stage and just pass them down to lower stages
func (*Stage) SetMain ¶
SetMain sets the [Stage.Main]: If a Popup Stage, this is the Main Stage that owns it (via its PopupMgr) If a Main Stage, it points to itself.
func (*Stage) SetMainMgr ¶
SetMainMgr sets the MainMgr to given Main StageMgr (on RenderWin) and also sets the RenderCtx from that.
func (*Stage) SetModal ¶
SetModal sets the [Stage.Modal]: if true, blocks input to all other stages.
func (*Stage) SetMovable ¶
SetMovable sets the [Stage.Movable]: for Dialogs: adds a handle titlebar Decor for moving
func (*Stage) SetName ¶
SetName sets the [Stage.Name]: name of the Stage -- generally auto-set based on Scene Name
func (*Stage) SetNameFromScene ¶
SetNameFromString sets the name of this Stage based on existing Scene and Type settings.
func (*Stage) SetNewWindow ¶
SetNewWindow sets the [Stage.NewWindow]: NewWindow: if true, opens a Window or Dialog in its own separate operating system window (RenderWin). This is by default true for Window on Desktop, otherwise false.
func (*Stage) SetPopupMgr ¶
SetPopupMgr sets the PopupMgr and MainMgr from the given *Main* Stage to which this PopupStage belongs.
func (*Stage) SetPos ¶
SetPos sets the [Stage.Pos]: Target position for Scene to be placed within RenderWin
func (*Stage) SetRenderCtx ¶
func (t *Stage) SetRenderCtx(v *RenderContext) *Stage
SetRenderCtx sets the [Stage.RenderCtx]: rendering context which has info about the RenderWin onto which we render. This should be used instead of the RenderWin itself for all relevant rendering information. This is only available once a Stage is Run, and must always be checked for nil.
func (*Stage) SetResizable ¶
SetResizable sets the [Stage.Resizable]: for Dialogs: adds a resize handle Decor for resizing
func (*Stage) SetScrim ¶
SetScrim sets the [Stage.Scrim]: if true, places a darkening scrim over other stages, if not a full window
func (*Stage) SetSide ¶
func (t *Stage) SetSide(v StageSides) *Stage
SetSide sets the [Stage.Side]: Side for Stages that can operate on different sides, e.g., for Sheets: which side does the sheet come out from
func (*Stage) SetSpriteDragging ¶
SetSpriteDragging sets the [Stage.SpriteDragging]: name of sprite that is being dragged -- sprite event function is responsible for setting this.
func (*Stage) SetSprites ¶
SetSprites sets the [Stage.Sprites]: sprites are named images that are rendered last overlaying everything else.
func (*Stage) SetTimeout ¶
SetTimeout sets the [Stage.Timeout]: if > 0, disappears after a timeout duration
func (*Stage) SetTitle ¶
SetTitle sets the [Stage.Title]: Title of the Stage -- generally auto-set based on Scene Title. Used for title of Window and Dialog types.
func (*Stage) SetType ¶
func (st *Stage) SetType(typ StageTypes) *Stage
SetType sets the type and also sets default parameters based on that type
type StageMgr ¶
type StageMgr struct { // stack of stages managed by this stage manager. Stack ordmap.Map[string, *Stage] `set:"-"` // Modified is set to true whenever the stack has been modified. // This is cleared by the RenderWin each render cycle. Modified bool // rendering context provides key rendering information and locking // for the RenderWin in which the stages are running. // the MainStageMgr within the RenderWin RenderCtx *RenderContext // render window to which we are rendering. // rely on the RenderCtx wherever possible. RenderWin *RenderWin // growing stack of viewing history of all stages. History []*Stage `set:"-"` // Main is the Main Stage that owns this StageMgr, only set for Popup stages Main *Stage // mutex protecting reading / updating of the Stack. // Destructive stack updating gets a Write lock, else Read. Mu sync.RWMutex `view:"-" set:"-"` }
StageMgr manages a stack of Stage elements
func (*StageMgr) DeleteAll ¶
func (sm *StageMgr) DeleteAll()
DeleteAll deletes all of the stages. For when Stage with Popups is Deleted, or when a RenderWindow is closed. requires outer RenderContext mutex!
func (*StageMgr) DeleteStage ¶
DeleteStage deletes given stage (removing from stack, calling Delete on Stage), returning true if found. It runs under Write lock.
func (*StageMgr) MainHandleEvent ¶
MainHandleEvent calls MainHandleEvent on relevant stages in reverse order.
func (*StageMgr) Pop ¶
Pop pops current Stage off the stack, returning it or nil if none. It runs under Write lock.
func (*StageMgr) PopDelete ¶
func (sm *StageMgr) PopDelete()
PopDelete pops current top--most Stage off the stack and calls Delete on it.
func (*StageMgr) PopDeleteType ¶
func (sm *StageMgr) PopDeleteType(typ StageTypes)
PopDeleteType pops the top-most Stage of the given type off the stack and calls Delete on it.
func (*StageMgr) PopType ¶
func (sm *StageMgr) PopType(typ StageTypes) *Stage
PopType pops the top-most Stage of the given type of the stack, returning it or nil if none. It runs under Write lock.
func (*StageMgr) PopupHandleEvent ¶
PopupHandleEvent processes Popup events. requires outer RenderContext mutex.
func (*StageMgr) SendShowEvents ¶
func (sm *StageMgr) SendShowEvents()
func (*StageMgr) TopIsModal ¶
TopIsModal returns true if there is a Top PopupStage and it is Modal.
func (*StageMgr) TopNotType ¶
func (sm *StageMgr) TopNotType(typ StageTypes) *Stage
TopNotType returns the top-most Stage in the Stack that is NOT the given type, under Read Lock
func (*StageMgr) TopOfType ¶
func (sm *StageMgr) TopOfType(typ StageTypes) *Stage
TopOfType returns the top-most Stage in the Stack of the given type, under Read Lock
func (*StageMgr) UniqueName ¶
UniqueName returns unique name for given item
func (*StageMgr) UpdateAll ¶
UpdateAll iterates through all Stages and calls DoUpdate on them. returns stageMods = true if any Stages have been modified (Main or Popup), and sceneMods = true if any Scenes have been modified. Stage calls DoUpdate on its Scene, ensuring everything is updated at the Widget level. If nothing is needed, nothing is done.
This is called only during RenderWin.RenderWindow,
under the global RenderCtx.Mu Write lock so nothing else can happen.
type StageSides ¶
type StageSides int32 //enums:enum
StageSides are the Sides for Sheet Stages
const ( // BottomSheet anchors Sheet to the bottom of the window, with handle on the top BottomSheet StageSides = iota // SideSheet anchors Sheet to the side of the window, with handle on the top SideSheet )
const StageSidesN StageSides = 2
StageSidesN is the highest valid value for type StageSides, plus one.
func StageSidesValues ¶
func StageSidesValues() []StageSides
StageSidesValues returns all possible values for the type StageSides.
func (StageSides) Desc ¶
func (i StageSides) Desc() string
Desc returns the description of the StageSides value.
func (StageSides) Int64 ¶
func (i StageSides) Int64() int64
Int64 returns the StageSides value as an int64.
func (StageSides) IsValid ¶
func (i StageSides) IsValid() bool
IsValid returns whether the value is a valid option for type StageSides.
func (StageSides) MarshalText ¶
func (i StageSides) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (*StageSides) SetInt64 ¶
func (i *StageSides) SetInt64(in int64)
SetInt64 sets the StageSides value from an int64.
func (*StageSides) SetString ¶
func (i *StageSides) SetString(s string) error
SetString sets the StageSides value from its string representation, and returns an error if the string is invalid.
func (StageSides) String ¶
func (i StageSides) String() string
String returns the string representation of this StageSides value.
func (*StageSides) UnmarshalText ¶
func (i *StageSides) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (StageSides) Values ¶
func (i StageSides) Values() []enums.Enum
Values returns all possible values for the type StageSides.
type StageTypes ¶
type StageTypes int32 //enums:enum
StageTypes are the types of Stage containers. There are two main categories: MainStage and PopupStage. MainStage are Window, Dialog, Sheet: large and potentially complex Scenes that persist until dismissed, and can have Decor widgets that control display. PopupStage are Menu, Tooltip, Snackbar, Chooser that are transitory and simple, without additional decor. MainStages live in a StageMgr associated with a RenderWin window, and manage their own set of PopupStages via a PopupStageMgr.
const ( // WindowStage is a MainStage that displays a Scene in a full window. // One of these must be created first, as the primary App contents, // and it typically persists throughout. It fills the RenderWin window. // Additional Windows can be created either within the same RenderWin // (Mobile) or in separate RenderWin windows (Desktop, NewWindow). WindowStage StageTypes = iota // DialogStage is a MainStage that displays Scene in a smaller dialog window // on top of a Window, or in its own RenderWin (on Desktop only). // It can be Modal or not. DialogStage // SheetStage is a MainStage that displays Scene as a // partially overlapping panel coming up from the // Bottom or LeftSide of the RenderWin main window. // It can be Modal or not. SheetStage // MenuStage is a PopupStage that displays a Scene with Action Widgets // overlaid on a MainStage. // It is typically Modal and ClickOff, and closes when // an Action is selected. MenuStage // TooltipStage is a PopupStage that displays a Scene with extra info // overlaid on a MainStage. // It is typically ClickOff and not Modal. TooltipStage // SnackbarStage is a PopupStage displays a Scene with info and typically // an additional optional Action, usually displayed at the bottom. // It is typically not ClickOff or Modal, but has a timeout. SnackbarStage // CompleterStage is a PopupStage that displays a Scene with text completions, // spelling corrections, or other such dynamic info. // It is typically ClickOff, not Modal, dynamically updating, // and closes when something is selected or typing renders // it no longer relevant. CompleterStage )
const StageTypesN StageTypes = 7
StageTypesN is the highest valid value for type StageTypes, plus one.
func StageTypesValues ¶
func StageTypesValues() []StageTypes
StageTypesValues returns all possible values for the type StageTypes.
func (StageTypes) Desc ¶
func (i StageTypes) Desc() string
Desc returns the description of the StageTypes value.
func (StageTypes) Int64 ¶
func (i StageTypes) Int64() int64
Int64 returns the StageTypes value as an int64.
func (StageTypes) IsMain ¶
func (st StageTypes) IsMain() bool
IsMain returns true if this type of Stage is a Main stage that manages its own set of popups
func (StageTypes) IsPopup ¶
func (st StageTypes) IsPopup() bool
IsPopup returns true if this type of Stage is a Popup, managed by another Main stage.
func (StageTypes) IsValid ¶
func (i StageTypes) IsValid() bool
IsValid returns whether the value is a valid option for type StageTypes.
func (StageTypes) MarshalText ¶
func (i StageTypes) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (*StageTypes) SetInt64 ¶
func (i *StageTypes) SetInt64(in int64)
SetInt64 sets the StageTypes value from an int64.
func (*StageTypes) SetString ¶
func (i *StageTypes) SetString(s string) error
SetString sets the StageTypes value from its string representation, and returns an error if the string is invalid.
func (StageTypes) String ¶
func (i StageTypes) String() string
String returns the string representation of this StageTypes value.
func (*StageTypes) UnmarshalText ¶
func (i *StageTypes) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (StageTypes) Values ¶
func (i StageTypes) Values() []enums.Enum
Values returns all possible values for the type StageTypes.
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 NewStretch ¶
NewStretch adds a new Stretch with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*Stretch) CopyFieldsFrom ¶
func (*Stretch) SetCustomContextMenu ¶
SetCustomContextMenu sets the [Stretch.CustomContextMenu]
func (*Stretch) SetTooltip ¶
SetTooltip sets the [Stretch.Tooltip]
type Stripes ¶
type Stripes int32 //enums:enum
Stripes defines stripes options for elements that can render striped backgrounds
const StripesN Stripes = 3
StripesN is the highest valid value for type Stripes, plus one.
func StripesValues ¶
func StripesValues() []Stripes
StripesValues returns all possible values for the type Stripes.
func (Stripes) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*Stripes) SetString ¶
SetString sets the Stripes value from its string representation, and returns an error if the string is invalid.
func (*Stripes) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type StyleSheet ¶
type StyleSheet struct { WidgetBase Sheet *css.Stylesheet }
StyleSheet is a Widget 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 NewStyleSheet ¶
func NewStyleSheet(par ki.Ki, name ...string) *StyleSheet
NewStyleSheet adds a new StyleSheet with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*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 ¶
func (ss *StyleSheet) CopyFieldsFrom(frm any)
func (*StyleSheet) KiType ¶
func (t *StyleSheet) KiType() *gti.Type
KiType returns the *gti.Type of StyleSheet
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
func (*StyleSheet) SetClass ¶
func (t *StyleSheet) SetClass(v string) *StyleSheet
SetClass sets the [StyleSheet.Class]
func (*StyleSheet) SetCustomContextMenu ¶
func (t *StyleSheet) SetCustomContextMenu(v func(m *Scene)) *StyleSheet
SetCustomContextMenu sets the [StyleSheet.CustomContextMenu]
func (*StyleSheet) SetSheet ¶
func (t *StyleSheet) SetSheet(v *css.Stylesheet) *StyleSheet
SetSheet sets the [StyleSheet.Sheet]
func (*StyleSheet) SetTooltip ¶
func (t *StyleSheet) SetTooltip(v string) *StyleSheet
SetTooltip sets the [StyleSheet.Tooltip]
type Switch ¶
type Switch struct { WidgetBase // the type of switch that this is Type SwitchTypes `set:"-"` // the label text for the switch Text string // icon to use for the on, checked state of the switch IconOn icons.Icon `view:"show-name"` // icon to use for the off, unchecked state of the switch IconOff icons.Icon `view:"show-name"` // icon to use for the indeterminate (unknown) state IconUnk icons.Icon `view:"show-name"` }
Switch is a widget that can toggle between an on and off state. It can be displayed as a switch, checkbox, or radio button.
func NewSwitch ¶
NewSwitch adds a new Switch with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*Switch) ClearIcons ¶
ClearIcons sets all of the switch icons to icons.None
func (*Switch) ConfigParts ¶
func (sw *Switch) ConfigParts()
func (*Switch) ConfigWidget ¶
func (sw *Switch) ConfigWidget()
func (*Switch) CopyFieldsFrom ¶
func (*Switch) HandleEvents ¶
func (sw *Switch) HandleEvents()
func (*Switch) LabelWidget ¶
LabelWidget returns the label widget if present
func (*Switch) RenderSwitch ¶
func (sw *Switch) RenderSwitch()
func (*Switch) SetChecked ¶
SetChecked sets the checked state and updates the icon accordingly
func (*Switch) SetCustomContextMenu ¶
SetCustomContextMenu sets the [Switch.CustomContextMenu]
func (*Switch) SetIconFromState ¶
func (sw *Switch) SetIconFromState()
SetIconFromState updates icon state based on checked status
func (*Switch) SetIconOff ¶
SetIconOff sets the [Switch.IconOff]: icon to use for the off, unchecked state of the switch
func (*Switch) SetIconOn ¶
SetIconOn sets the [Switch.IconOn]: icon to use for the on, checked state of the switch
func (*Switch) SetIconUnk ¶
SetIconUnk sets the [Switch.IconUnk]: icon to use for the indeterminate (unknown) state
func (*Switch) SetIcons ¶
SetIcons sets the icons for the on (checked), off (unchecked) and indeterminante (unknown) states. See [SetIconsUpdate] for a version that updates the icon rendering
func (*Switch) SetIconsUpdate ¶
SetIconsUpdate sets the icons for the on (checked), off (unchecked) and indeterminante (unknown) states. Drives updating of underlying icon rendering, for use post-display.
func (*Switch) SetTooltip ¶
SetTooltip sets the [Switch.Tooltip]
func (*Switch) SetType ¶
func (sw *Switch) SetType(typ SwitchTypes) *Switch
SetType sets the styling type of the switch
type SwitchTypes ¶
type SwitchTypes int32 //enums:enum -trimprefix Switch
SwitchTypes contains the different types of [Switch]es
const ( // SwitchSwitch indicates to display a switch as a switch (toggle slider) SwitchSwitch SwitchTypes = iota // SwitchChip indicates to display a switch as chip (like Material Design's filter chip), // which is typically only used in the context of [Switches]. SwitchChip // SwitchCheckbox indicates to display a switch as a checkbox SwitchCheckbox // SwitchRadioButton indicates to display a switch as a radio button SwitchRadioButton // SwitchSegmentedButton indicates to display a segmented button, which is typically only used in // the context of [Switches]. SwitchSegmentedButton )
const SwitchTypesN SwitchTypes = 5
SwitchTypesN is the highest valid value for type SwitchTypes, plus one.
func SwitchTypesValues ¶
func SwitchTypesValues() []SwitchTypes
SwitchTypesValues returns all possible values for the type SwitchTypes.
func (SwitchTypes) Desc ¶
func (i SwitchTypes) Desc() string
Desc returns the description of the SwitchTypes value.
func (SwitchTypes) Int64 ¶
func (i SwitchTypes) Int64() int64
Int64 returns the SwitchTypes value as an int64.
func (SwitchTypes) IsValid ¶
func (i SwitchTypes) IsValid() bool
IsValid returns whether the value is a valid option for type SwitchTypes.
func (SwitchTypes) MarshalText ¶
func (i SwitchTypes) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (*SwitchTypes) SetInt64 ¶
func (i *SwitchTypes) SetInt64(in int64)
SetInt64 sets the SwitchTypes value from an int64.
func (*SwitchTypes) SetString ¶
func (i *SwitchTypes) SetString(s string) error
SetString sets the SwitchTypes value from its string representation, and returns an error if the string is invalid.
func (SwitchTypes) String ¶
func (i SwitchTypes) String() string
String returns the string representation of this SwitchTypes value.
func (*SwitchTypes) UnmarshalText ¶
func (i *SwitchTypes) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (SwitchTypes) Values ¶
func (i SwitchTypes) Values() []enums.Enum
Values returns all possible values for the type SwitchTypes.
type Switches ¶
type Switches struct { Frame // the type of switches that will be made Type SwitchTypes // the list of items (switch labels) Items []string // an optional list of tooltips displayed on hover for checkbox items; the indices for tooltips correspond to those for items Tooltips []string // whether to make the items mutually exclusive (checking one turns off all the others) Mutex bool }
Switches is a widget for containing a set of switches. It can optionally enforce mutual exclusivity (i.e., Radio Buttons). The buttons are all in the Parts of the widget and the Parts layout determines how they are displayed.
func AsSwitches ¶
func AsSwitches(k ki.Ki) *Switches
AsSwitches returns the given value as a value of type Switches if the type of the given value embeds Switches, or nil otherwise
func NewSwitches ¶
NewSwitches adds a new Switches with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*Switches) AsSwitches ¶
AsSwitches satisfies the SwitchesEmbedder interface
func (*Switches) BitFlagValue ¶
func (sw *Switches) BitFlagValue(bitflag enums.BitFlagSetter)
BitFlagsValue sets the given bitflag value to the value specified by the switches.
func (*Switches) ConfigItems ¶
func (sw *Switches) ConfigItems()
func (*Switches) ConfigSwitches ¶
func (sw *Switches) ConfigSwitches()
func (*Switches) ConfigWidget ¶
func (sw *Switches) ConfigWidget()
func (*Switches) CopyFieldsFrom ¶
func (*Switches) HandleSwitchEvents ¶
HandleSwitchEvents handles the events for the given switch.
func (*Switches) SelectItem ¶
SelectItem activates a given item but does NOT send a change event. See SelectItemAction for event emitting version. returns error if index is out of range.
func (*Switches) SelectItemAction ¶
SelectItemAction activates a given item and emits a change event. This is mainly for Mutex use. returns error if index is out of range.
func (*Switches) SelectedItem ¶
SelectedItem returns the first selected (checked) switch. It is only useful when [Switches.Mutex] is true. If no switches are selected, it returns "".
func (*Switches) SetCustomContextMenu ¶
SetCustomContextMenu sets the [Switches.CustomContextMenu]
func (*Switches) SetEnum ¶
SetEnum sets the Items list from an enum value by calling Switches.SetEnums using the result of enums.Enum.Values on the given value
func (*Switches) SetMutex ¶
SetMutex sets the [Switches.Mutex]: whether to make the items mutually exclusive (checking one turns off all the others)
func (*Switches) SetStackTop ¶
SetStackTop sets the [Switches.StackTop]
func (*Switches) SetStrings ¶
SetStrings 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 (*Switches) SetStripes ¶
SetStripes sets the [Switches.Stripes]
func (*Switches) SetTooltip ¶
SetTooltip sets the [Switches.Tooltip]
func (*Switches) SetTooltips ¶
SetTooltips sets the [Switches.Tooltips]: an optional list of tooltips displayed on hover for checkbox items; the indices for tooltips correspond to those for items
func (*Switches) SetType ¶
func (t *Switches) SetType(v SwitchTypes) *Switches
SetType sets the [Switches.Type]: the type of switches that will be made
func (*Switches) UnCheckAllBut ¶
UnCheckAllBut unchecks all switches except given one
func (*Switches) UpdateFromBitFlag ¶
UpdateFromBitFlags sets the checked state of the switches from the given bit flag enum value.
type SwitchesEmbedder ¶
type SwitchesEmbedder interface {
AsSwitches() *Switches
}
SwitchesEmbedder is an interface that all types that embed Switches satisfy
type Tab ¶
type Tab struct { Button // Maximum number of characters to include in tab label. // Elides labels that are longer than that MaxChars int // if true, this tab has a delete button (true by default) DeleteButton bool }
Tab is a tab button that contains a larger select button and a smaller close button. The Indicator icon is used for the close icon.
func NewTab ¶
NewTab adds a new Tab with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*Tab) ConfigParts ¶
func (tb *Tab) ConfigParts()
func (*Tab) ConfigPartsDeleteButton ¶
func (tb *Tab) ConfigPartsDeleteButton()
func (*Tab) ConfigWidget ¶
func (tb *Tab) ConfigWidget()
func (*Tab) SetCustomContextMenu ¶
SetCustomContextMenu sets the [Tab.CustomContextMenu]
func (*Tab) SetDeleteButton ¶
SetDeleteButton sets the [Tab.DeleteButton]: if true, this tab has a delete button (true by default)
func (*Tab) SetIndicator ¶
SetIndicator sets the [Tab.Indicator]
func (*Tab) SetMaxChars ¶
SetMaxChars sets the [Tab.MaxChars]: Maximum number of characters to include in tab label. Elides labels that are longer than that
func (*Tab) SetShortcut ¶
SetShortcut sets the [Tab.Shortcut]
type Tabs ¶
type Tabs struct { Layout // Maximum number of characters to include in tab label. // Elides labels that are longer than that MaxChars int // show a new tab button at right of list of tabs NewTabButton bool // if true, tabs are user-deleteable (false by default) DeleteTabButtons bool // mutex protecting updates to tabs. // Tabs can be driven programmatically and via user input so need extra protection Mu sync.Mutex `copy:"-" json:"-" xml:"-" view:"-" set:"-"` }
Tabs switches among child widgets via tabs. The selected widget gets the full allocated space avail after the tabs are accounted for. The Tabs 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 AsTabs ¶
func AsTabs(k ki.Ki) *Tabs
AsTabs returns the given value as a value of type Tabs if the type of the given value embeds Tabs, or nil otherwise
func NewTabs ¶
NewTabs adds a new Tabs with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*Tabs) AddTab ¶
AddTab adds an already existing frame as a new tab with the given tab label and returns the index of that tab.
func (*Tabs) ConfigNewTabButton ¶
ConfigNewTabButton configures the new tab + button at end of list of tabs
func (*Tabs) ConfigWidget ¶
func (ts *Tabs) ConfigWidget()
ConfigWidget initializes the tab widget children if it hasn't been done yet. only the 2 primary children (Frames) need to be configured. no re-config needed when adding / deleting tabs -- just new layout.
func (*Tabs) CopyFieldsFrom ¶
func (*Tabs) DeleteTabIndex ¶
DeleteTabIndex deletes tab at given index, optionally calling destroy on tab contents -- returns frame if destroy == false, tab label, and bool success
func (*Tabs) Frame ¶
Frame returns the stacked frame layout (the second element within us). It configures the Tabs if necessary.
func (*Tabs) InsertNewTab ¶
InsertNewTab inserts a new tab with the given label at the given index position within the list of tabs and returns the resulting tab frame.
func (*Tabs) InsertTabOnlyAt ¶
InsertTabOnlyAt inserts just the tab at given index, after the panel has already been added to the frame; assumed to be wrapped in update. Generally for internal use only.
func (*Tabs) NewTab ¶
NewTab adds a new tab with the given label and returns the resulting tab frame. It is the main end-user API for creating new tabs.
func (*Tabs) RecycleTab ¶
RecycleTab returns a tab with given label, first by looking for an existing one, and if not found, making a new one. If sel, then select it. It returns the frame for the tab.
func (*Tabs) RecycleTabWidget ¶
RecycleTabWidget returns a tab with given widget type in the tab frame, first by looking for an existing one, with given label, and if not found, making and configuring a new one. If sel, then select it. It returns the Widget item for the tab.
func (*Tabs) RenumberTabs ¶
func (ts *Tabs) RenumberTabs()
RenumberTabs assigns proper index numbers to each tab
func (*Tabs) SelectTabByLabel ¶
SelectTabByLabel selects tab by label, returning it.
func (*Tabs) SelectTabIndex ¶
SelectTabIndex selects tab at given index, returning it. Returns false if index is invalid. This is the final tab selection path.
func (*Tabs) SetCustomContextMenu ¶
SetCustomContextMenu sets the [Tabs.CustomContextMenu]
func (*Tabs) SetDeleteTabButtons ¶
SetDeleteTabButtons sets the [Tabs.DeleteTabButtons]: if true, tabs are user-deleteable (false by default)
func (*Tabs) SetMaxChars ¶
SetMaxChars sets the [Tabs.MaxChars]: Maximum number of characters to include in tab label. Elides labels that are longer than that
func (*Tabs) SetNewTabButton ¶
SetNewTabButton sets the [Tabs.NewTabButton]: show a new tab button at right of list of tabs
func (*Tabs) SetStackTop ¶
SetStackTop sets the [Tabs.StackTop]
func (*Tabs) SetTooltip ¶
SetTooltip sets the [Tabs.Tooltip]
func (*Tabs) TabAtIndex ¶
TabAtIndex returns content frame and tab button at given index, false if index out of range (emits log message)
func (*Tabs) TabByLabel ¶
TabByLabel returns tab with given label (nil if not found)
func (*Tabs) TabIndexByLabel ¶
TabIndexByLabel returns the tab index for the given tab label and -1, false if it can not be found.
func (*Tabs) Tabs ¶
Tabs returns the layout containing the tabs (the first element within us). It configures the Tabs if necessary.
func (*Tabs) UnselectOtherTabs ¶
UnselectOtherTabs turns off all the tabs except given one
type TabsEmbedder ¶
type TabsEmbedder interface {
AsTabs() *Tabs
}
TabsEmbedder is an interface that all types that embed Tabs satisfy
type TextField ¶
type TextField struct { WidgetBase // the last saved value of the text string being edited Txt string `json:"-" xml:"text" set:"-"` // text that is displayed when the field is empty, in a lower-contrast manner Placeholder string `json:"-" xml:"placeholder"` // functions and data for textfield completion Complete *Complete `copy:"-" json:"-" xml:"-"` // replace displayed characters with bullets to conceal text NoEcho bool // if specified, a button will be added at the start of the text field with this icon LeadingIcon icons.Icon `set:"-"` // if LeadingIcon is specified, the function to call when the leading icon is clicked LeadingIconOnClick func(e events.Event) // if specified, a button will be added at the end of the text field with this icon TrailingIcon icons.Icon `set:"-"` // if TrailingIcon is specified, the function to call when the trailing icon is clicked TrailingIconOnClick func(e events.Event) // width of cursor -- set from cursor-width property (inherited) CursorWidth units.Value `xml:"cursor-width"` // the type of the text field Type TextFieldTypes // the color used for the placeholder text; this should be set in Stylers like all other style properties; it is typically a highlighted version of the normal text color PlaceholderColor color.RGBA // the color used for the text selection background color on active text fields; this should be set in Stylers like all other style properties SelectColor image.Image // the color used for the text field cursor (caret); this should be set in Stylers like all other style properties CursorColor image.Image // true if the text has been edited relative to the original Edited bool `json:"-" xml:"-" set:"-"` // the live text string being edited, with latest modifications -- encoded as runes EditTxt []rune `json:"-" xml:"-" set:"-"` // maximum width that field will request, in characters, during GetSize process -- if 0 then is 50 -- ensures that large strings don't request super large values -- standard max-width can override MaxWidthReq int // effective position with any leading icon space added EffPos mat32.Vec2 `copy:"-" json:"-" xml:"-" set:"-"` // effective size, subtracting any leading and trailing icon space EffSize mat32.Vec2 `copy:"-" json:"-" xml:"-" set:"-"` // starting display position in the string StartPos int `copy:"-" json:"-" xml:"-" set:"-"` // ending display position in the string EndPos int `copy:"-" json:"-" xml:"-" set:"-"` // current cursor position CursorPos int `copy:"-" json:"-" xml:"-" set:"-"` // approximate number of chars that can be displayed at any time -- computed from font size etc CharWidth int `copy:"-" json:"-" xml:"-" set:"-"` // starting position of selection in the string SelectStart int `copy:"-" json:"-" xml:"-" set:"-"` // ending position of selection in the string SelectEnd int `copy:"-" json:"-" xml:"-" set:"-"` // initial selection position -- where it started SelectInit int `copy:"-" json:"-" xml:"-" set:"-"` // if true, select text as cursor moves SelectMode bool `copy:"-" json:"-" xml:"-"` // render version of entire text, for sizing RenderAll paint.Text `copy:"-" json:"-" xml:"-" set:"-"` // render version of just visible text RenderVis paint.Text `copy:"-" json:"-" xml:"-" set:"-"` // font height, cached during styling FontHeight float32 `copy:"-" json:"-" xml:"-" set:"-"` // oscillates between on and off for blinking BlinkOn bool `copy:"-" json:"-" xml:"-" set:"-"` // mutex for updating cursor between blinker and field CursorMu sync.Mutex `copy:"-" json:"-" xml:"-" view:"-" set:"-"` }
TextField is a widget for editing a line of text
var BlinkingTextField *TextField
BlinkingTextField is the text field that is blinking
func AsTextField ¶
func AsTextField(k ki.Ki) *TextField
AsTextField returns the given value as a value of type TextField if the type of the given value embeds TextField, or nil otherwise
func NewTextField ¶
NewTextField adds a new TextField with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*TextField) AddClearButton ¶
AddClearButton adds a trailing icon button at the end of the textfield that clears the text in the textfield when pressed
func (*TextField) ApplyStyle ¶
func (tf *TextField) ApplyStyle()
func (*TextField) AsTextField ¶
AsTextField satisfies the TextFieldEmbedder interface
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) ConfigWidget ¶
func (tf *TextField) ConfigWidget()
func (*TextField) ContextMenu ¶
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 ¶
func (*TextField) CursorBackspace ¶
CursorBackspace deletes character(s) immediately before cursor
func (*TextField) CursorBackspaceWord ¶
CursorBackspaceWord deletes words(s) immediately before cursor
func (*TextField) CursorBackward ¶
CursorBackward moves the cursor backward
func (*TextField) CursorBackwardWord ¶
CursorBackwardWord moves the cursor backward by words
func (*TextField) CursorDelete ¶
CursorDelete deletes character(s) immediately after the cursor
func (*TextField) CursorDeleteWord ¶
CursorDeleteWord deletes word(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) CursorForwardWord ¶
CursorForwardWord moves the cursor forward by words
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). On sets the On status of the cursor.
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) 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) HandleEvents ¶
func (tf *TextField) HandleEvents()
func (*TextField) HandleKeys ¶
func (tf *TextField) HandleKeys()
func (*TextField) HandleMouse ¶
func (tf *TextField) HandleMouse()
func (*TextField) HandleStateFromFocus ¶
func (tf *TextField) HandleStateFromFocus()
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) IsWordBreak ¶
IsWordBreak defines what counts as a word break for the purposes of selecting words
func (*TextField) LeadingIconButton ¶
LeadingIconButton returns the [LeadingIcon] Button if present, else false
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 ¶
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) SetComplete ¶
SetComplete sets the [TextField.Complete]: functions and data for textfield completion
func (*TextField) SetCompleter ¶
SetCompleter sets completion functions so that completions will automatically be offered as the user types
func (*TextField) SetCursorColor ¶
SetCursorColor sets the [TextField.CursorColor]: the color used for the text field cursor (caret); this should be set in Stylers like all other style properties
func (*TextField) SetCursorFromPixel ¶
func (tf *TextField) SetCursorFromPixel(pixOff float32, selMode events.SelectModes)
SetCursorFromPixel finds cursor location from pixel offset relative to WinBBox of text field, and sets current cursor to it, updating selection too.
func (*TextField) SetCursorWidth ¶
SetCursorWidth sets the [TextField.CursorWidth]: width of cursor -- set from cursor-width property (inherited)
func (*TextField) SetCustomContextMenu ¶
SetCustomContextMenu sets the [TextField.CustomContextMenu]
func (*TextField) SetEffPosAndSize ¶
func (tf *TextField) SetEffPosAndSize()
SetEffPosAndSize sets the effective position and size of the textfield based on its base position and size and its icons or lack thereof
func (*TextField) SetLeadingIcon ¶
SetLeadingIcon sets the leading icon of the text field to the given icon. If an on click function is specified, it also sets the leading icon on click function to that function. If no function is specified, it does not override any already set function.
func (*TextField) SetLeadingIconOnClick ¶
SetLeadingIconOnClick sets the [TextField.LeadingIconOnClick]: if LeadingIcon is specified, the function to call when the leading icon is clicked
func (*TextField) SetLeadingIconUpdate ¶
func (tf *TextField) SetLeadingIconUpdate(icon icons.Icon, onClick ...func(e events.Event)) *TextField
SetLeadingIconUpdate sets the leading icon of the text field to the given icon, and ensures that it will render with new icon, for already displayed case. If an on click function is specified, it also sets the leading icon on click function to that function. If no function is specified, it does not override any already set function.
func (*TextField) SetMaxWidthReq ¶
SetMaxWidthReq sets the [TextField.MaxWidthReq]: maximum width that field will request, in characters, during GetSize process -- if 0 then is 50 -- ensures that large strings don't request super large values -- standard max-width can override
func (*TextField) SetNoEcho ¶
SetNoEcho sets the [TextField.NoEcho]: replace displayed characters with bullets to conceal text
func (*TextField) SetPlaceholder ¶
SetPlaceholder sets the [TextField.Placeholder]: text that is displayed when the field is empty, in a lower-contrast manner
func (*TextField) SetPlaceholderColor ¶
SetPlaceholderColor sets the [TextField.PlaceholderColor]: the color used for the placeholder text; this should be set in Stylers like all other style properties; it is typically a highlighted version of the normal text color
func (*TextField) SetSelectColor ¶
SetSelectColor sets the [TextField.SelectColor]: the color used for the text selection background color on active text fields; this should be set in Stylers like all other style properties
func (*TextField) SetSelectMode ¶
SetSelectMode sets the [TextField.SelectMode]: if true, select text as cursor moves
func (*TextField) SetText ¶
SetText sets the text to be edited and reverts any current edit to reflect this new text.
func (*TextField) SetTextUpdate ¶
SetTextUpdate sets the text to be edited and reverts any current edit to reflect this new text, and triggers a Render update
func (*TextField) SetTooltip ¶
SetTooltip sets the [TextField.Tooltip]
func (*TextField) SetTrailingIcon ¶
SetTrailingIcon sets the trailing icon of the text field to the given icon. If an on click function is specified, it also sets the trailing icon on click function to that function. If no function is specified, it does not override any already set function.
func (*TextField) SetTrailingIconOnClick ¶
SetTrailingIconOnClick sets the [TextField.TrailingIconOnClick]: if TrailingIcon is specified, the function to call when the trailing icon is clicked
func (*TextField) SetTrailingIconUpdate ¶
func (tf *TextField) SetTrailingIconUpdate(icon icons.Icon, onClick ...func(e events.Event)) *TextField
SetTrailingIconUpdate sets the trailing icon of the text field to the given icon, and ensures that it will render with new icon, for already displayed case. If an on click function is specified, it also sets the leading icon on click function to that function. If no function is specified, it does not override any already set function.
func (*TextField) SetType ¶
func (t *TextField) SetType(v TextFieldTypes) *TextField
SetType sets the [TextField.Type]: the type of the text field
func (*TextField) SetTypePassword ¶
SetTypePassword enables [TextField.NoEcho] and adds a trailing icon button at the end of the textfield that toggles [TextField.NoEcho]
func (*TextField) ShiftSelect ¶
ShiftSelect sets the selection start if the shift key is down but wasn't previously. If the shift key has been released, the selection info is cleared.
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) TextFieldContextMenu ¶
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) TrailingIconButton ¶
TrailingIconButton returns the [TrailingIcon] Button if present, else false
func (*TextField) UpdateRenderAll ¶
type TextFieldEmbedder ¶
type TextFieldEmbedder interface {
AsTextField() *TextField
}
TextFieldEmbedder is an interface that all types that embed TextField satisfy
type TextFieldTypes ¶
type TextFieldTypes int32 //enums:enum
TextFieldTypes is an enum containing the different possible types of text fields
const ( // TextFieldFilled represents a filled // TextField with a background color // and a bottom border TextFieldFilled TextFieldTypes = iota // TextFieldOutlined represents an outlined // TextField with a border on all sides // and no background color TextFieldOutlined )
const TextFieldTypesN TextFieldTypes = 2
TextFieldTypesN is the highest valid value for type TextFieldTypes, plus one.
func TextFieldTypesValues ¶
func TextFieldTypesValues() []TextFieldTypes
TextFieldTypesValues returns all possible values for the type TextFieldTypes.
func (TextFieldTypes) Desc ¶
func (i TextFieldTypes) Desc() string
Desc returns the description of the TextFieldTypes value.
func (TextFieldTypes) Int64 ¶
func (i TextFieldTypes) Int64() int64
Int64 returns the TextFieldTypes value as an int64.
func (TextFieldTypes) IsValid ¶
func (i TextFieldTypes) IsValid() bool
IsValid returns whether the value is a valid option for type TextFieldTypes.
func (TextFieldTypes) MarshalText ¶
func (i TextFieldTypes) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (*TextFieldTypes) SetInt64 ¶
func (i *TextFieldTypes) SetInt64(in int64)
SetInt64 sets the TextFieldTypes value from an int64.
func (*TextFieldTypes) SetString ¶
func (i *TextFieldTypes) SetString(s string) error
SetString sets the TextFieldTypes value from its string representation, and returns an error if the string is invalid.
func (TextFieldTypes) String ¶
func (i TextFieldTypes) String() string
String returns the string representation of this TextFieldTypes value.
func (*TextFieldTypes) UnmarshalText ¶
func (i *TextFieldTypes) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (TextFieldTypes) Values ¶
func (i TextFieldTypes) Values() []enums.Enum
Values returns all possible values for the type TextFieldTypes.
type Themes ¶
type Themes int32 //enums:enum -trimprefix Theme
Themes are the different possible themes that a user can select in their preferences.
const ThemesN Themes = 3
ThemesN is the highest valid value for type Themes, plus one.
func ThemesValues ¶
func ThemesValues() []Themes
ThemesValues returns all possible values for the type Themes.
func (Themes) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*Themes) SetString ¶
SetString sets the Themes value from its string representation, and returns an error if the string is invalid.
func (*Themes) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Toolbar ¶
type Toolbar struct { Frame // items moved from the main toolbar, will be shown in the overflow menu OverflowItems ki.Slice `set:"-" json:"-" xml:"-"` // functions for overflow menu: use AddOverflowMenu to add. // These are processed in _reverse_ order (last in, first called) // so that the default items are added last. OverflowMenus []func(m *Scene) `set:"-" json:"-" xml:"-"` // ToolbarFuncs contains functions for configuring this toolbar, // called on Config ToolbarFuncs ToolbarFuncs // This is the overflow button OverflowButton *Button }
Toolbar is a Frame that is useful for holding [Button]s that do things. It automatically moves items that do not fit into an overflow menu, and manages additional items that are always placed onto this overflow menu. In general it should be possible to use a single toolbar + overflow to manage all an app's functionality, in a way that is portable across mobile and desktop environments. See [Widget.ConfigToolbar] for the standard toolbar config method for any given widget, and [Scene.AppBars] for ToolbarFuncs for Scene elements who should be represented in the main AppBar (e.g., TopAppBar).
func AsToolbar ¶
func AsToolbar(k ki.Ki) *Toolbar
AsToolbar returns the given value as a value of type Toolbar if the type of the given value embeds Toolbar, or nil otherwise
func NewToolbar ¶
NewToolbar adds a new Toolbar with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func RecycleToolbar ¶
RecycleToolbar constructs or returns a Toolbar in given parent Widget
func (*Toolbar) AddOverflowMenu ¶
AddOverflowMenu adds given menu function to overflow menu list
func (*Toolbar) AllItemsToChildren ¶
func (tb *Toolbar) AllItemsToChildren()
AllItemsToChildren moves the overflow items back to the children, so the full set is considered for the next layout round, and ensures the overflow button is made and moves it to the end of the list.
func (*Toolbar) AsToolbar ¶
AsToolbar satisfies the ToolbarEmbedder interface
func (*Toolbar) ConfigWidget ¶
func (tb *Toolbar) ConfigWidget()
func (*Toolbar) CopyFieldsFrom ¶
func (*Toolbar) DeleteShortcuts ¶
func (tb *Toolbar) DeleteShortcuts()
DeleteShortcuts deletes the shortcuts -- called when destroyed
func (*Toolbar) MoveToOverflow ¶
func (tb *Toolbar) MoveToOverflow()
MoveToOverflow moves overflow out of children to the OverflowItems list
func (*Toolbar) OverflowMenu ¶
OverflowMenu is the overflow menu function
func (*Toolbar) ParentSize ¶
func (*Toolbar) SetCustomContextMenu ¶
SetCustomContextMenu sets the [Toolbar.CustomContextMenu]
func (*Toolbar) SetOverflowButton ¶
SetOverflowButton sets the [Toolbar.OverflowButton]: This is the overflow button
func (*Toolbar) SetShortcuts ¶
func (tb *Toolbar) SetShortcuts()
SetShortcuts sets the shortcuts to window associated with Toolbar
func (*Toolbar) SetStackTop ¶
SetStackTop sets the [Toolbar.StackTop]
func (*Toolbar) SetStripes ¶
SetStripes sets the [Toolbar.Stripes]
func (*Toolbar) SetToolbarFuncs ¶
func (t *Toolbar) SetToolbarFuncs(v ToolbarFuncs) *Toolbar
SetToolbarFuncs sets the [Toolbar.ToolbarFuncs]: ToolbarFuncs contains functions for configuring this toolbar, called on Config
func (*Toolbar) SetTooltip ¶
SetTooltip sets the [Toolbar.Tooltip]
func (*Toolbar) SizeFromChildren ¶
func (tb *Toolbar) SizeFromChildren(iter int, pass LayoutPasses) mat32.Vec2
func (*Toolbar) StdOverflowMenu ¶
StdOverflowMenu adds standard overflow menu items.
type ToolbarEmbedder ¶
type ToolbarEmbedder interface {
AsToolbar() *Toolbar
}
ToolbarEmbedder is an interface that all types that embed Toolbar satisfy
type ToolbarFuncs ¶
type ToolbarFuncs []func(tb *Toolbar)
ToolbarFuncs are functions for creating control bars, attached to different sides of a Scene (e.g., TopAppBar at Top, NavBar at Bottom, etc). Functions are called in forward order so first added are called first.
func (*ToolbarFuncs) Add ¶
func (bf *ToolbarFuncs) Add(fun func(tb *Toolbar)) *ToolbarFuncs
Add adds the given function for configuring a toolbar
func (*ToolbarFuncs) Call ¶
func (bf *ToolbarFuncs) Call(tb *Toolbar)
Call calls all the functions for configuring given toolbar
func (*ToolbarFuncs) IsEmpty ¶
func (bf *ToolbarFuncs) IsEmpty() bool
IsEmpty returns true if there are no functions added
type Updater ¶
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 // default email address -- e.g., for recording changes in a version control system Email string }
User basic user information that might be needed for different apps
type ViewIFace ¶
type ViewIFace interface { // CallFunc calls the given function in the context of the given widget, // popping up a dialog to prompt for any arguments and show the return // values of the function. It is a helper function that uses [NewSoloFuncButton] // under the hood. CallFunc(ctx Widget, fun any) // Inspector opens an interactive editor of given Ki tree, at its root Inspector(obj ki.Ki) // PrefsView opens an interactive view of given preferences object PrefsView(prefs *GeneralSettingsData) // KeyMapsView opens an interactive view of KeyMaps object KeyMapsView(maps *keyfun.Maps) // 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 Widget ¶
type Widget interface { ki.Ki // OnWidgetAdded adds a function to call when a widget is added // as a child to the widget or any of its children. OnWidgetAdded(f func(w Widget)) *WidgetBase // Style sets the styling of the widget by adding a Styler function Style(s func(s *styles.Style)) *WidgetBase // AsWidget returns the WidgetBase embedded field for any Widget node. // The Widget interface defines only methods that can be overridden // or need to be called on other nodes. Everything else that is common // to all Widgets is in the WidgetBase. AsWidget() *WidgetBase // Config configures the widget, primarily configuring its Parts. // it does _not_ call Config on children, just self. // ApplyStyle must generally be called after Config - it is called // automatically when Scene is first shown, but must be called // manually thereafter as needed after configuration changes. // See Update for a convenience function that does both. // ConfigScene on Scene handles full tree configuration. // This config calls UpdateStart / End, and SetNeedsLayout, // and calls ConfigWidget to do the actual configuration, // so it does not need to manage this housekeeping. // Thus, this Config call is typically never changed, and // all custom configuration should happen in ConfigWidget. Config() // ConfigWidget does the actual configuration of the widget, // primarily configuring its Parts. // All configuration should be robust to multiple calls // (i.e., use Parts.ConfigChildren with Config). // Outer Config call handles all the other infrastructure, // so this call just does the core configuration. ConfigWidget() // Update calls Config and ApplyStyle on this widget. // This should be called if any config options are changed // while the Scene is being viewed. Update() // StateIs returns whether the widget has the given [states.States] flag set StateIs(flag states.States) bool // AbilityIs returns whether the widget has the given [abilities.Abilities] flag set AbilityIs(flag abilities.Abilities) bool // SetState sets the given [states.State] flags to the given value SetState(on bool, state ...states.States) *WidgetBase // SetAbilities sets the given [abilities.Abilities] flags to the given value SetAbilities(on bool, able ...abilities.Abilities) *WidgetBase // ApplyStyle applies style functions to the widget based on current state. // It is typically not overridden; instead, call Style to apply custom styling. ApplyStyle() // SizeUp (bottom-up) gathers Actual sizes from our Children & Parts, // based on Styles.Min / Max sizes and actual content sizing // (e.g., text size). Flexible elements (e.g., Label, Flex Wrap, // TopAppBar) should reserve the _minimum_ size possible at this stage, // and then Grow based on SizeDown allocation. SizeUp() // SizeDown (top-down, multiple iterations possible) provides top-down // size allocations based initially on Scene available size and // the SizeUp Actual sizes. If there is extra space available, it is // allocated according to the Grow factors. // Flexible elements (e.g., Flex Wrap layouts and Label with word wrap) // update their Actual size based on available Alloc size (re-wrap), // to fit the allocated shape vs. the initial bottom-up guess. // However, do NOT grow the Actual size to match Alloc at this stage, // as Actual sizes must always represent the minimums (see Position). // Returns true if any change in Actual size occurred. SizeDown(iter int) bool // SizeFinal: (bottom-up) similar to SizeUp but done at the end of the // Sizing phase: first grows widget Actual sizes based on their Grow // factors, up to their Alloc sizes. Then gathers this updated final // actual Size information for layouts to register their actual sizes // prior to positioning, which requires accurate Actual vs. Alloc // sizes to perform correct alignment calculations. SizeFinal() // Position uses the final sizes to set relative positions within layouts // according to alignment settings, and Grow elements to their actual // Alloc size per Styles settings and widget-specific behavior. Position() // ScenePos computes scene-based absolute positions and final BBox // bounding boxes for rendering, based on relative positions from // Position step and parents accumulated position and scroll offset. // This is the only step needed when scrolling (very fast). ScenePos() // Render performs actual rendering pass. Bracket the render calls in // PushBounds / PopBounds and a false from PushBounds indicates that // the node is invisible and should not be rendered. // If Parts are present, RenderParts is called by default. // Layouts or other widgets that manage children should call RenderChildren. Render() // On adds an event listener function for the given event type On(etype events.Types, fun func(e events.Event)) *WidgetBase // OnClick adds an event listener function for [events.Click] events OnClick(fun func(e events.Event)) *WidgetBase // HandleEvent sends the given event to all Listeners for that event type. // It also checks if the State has changed and calls ApplyStyle if so. // If more significant Config level changes are needed due to an event, // the event handler must do this itself. HandleEvent(e events.Event) // Send sends an NEW event of given type to this widget, // optionally starting from values in the given original event // (recommended to include where possible). // Do NOT send an existing event using this method if you // want the Handled state to persist throughout the call chain; // call HandleEvent directly for any existing events. Send(e events.Types, orig ...events.Event) // ContextMenu adds the context menu items (typically [Button]s) // for the widget to the given menu scene. No context menu is defined // by default, but widget types can implement this function if they // have a context menu. ContextMenu also calls // [WidgetBase.CustomContextMenu] if it is not nil. ContextMenu(m *Scene) // ContextMenuPos returns the default position for popup menus -- // by default in the middle its Bounding Box, but can be adapted as // appropriate for different widgets. ContextMenuPos(e events.Event) image.Point // ShowContextMenu displays the context menu of various actions // to perform on a Widget, activated by default on the ShowContextMenu // event, triggered by a Right mouse click. // Returns immediately, and actions are all executed directly // (later) via the action signals. Calls MakeContextMenu and // ContextMenuPos. ShowContextMenu(e events.Event) // IsVisible returns true if a node is visible for rendering according // to the [states.Invisible] flag on it or any of its parents. // This flag is also set by [styles.DisplayNone] during [ApplyStyle]. // This does *not* check for an empty TotalBBox, indicating that the widget // is out of render range -- that is done by [PushBounds] prior to rendering. // Non-visible nodes are automatically not rendered and do not get // window events. // This call recursively calls the parent, which is typically a short path. 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 scene 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() }
Widget is the interface for all GoGi Widget Nodes
func NonNilContext ¶
type WidgetBase ¶
type WidgetBase struct { ki.Node // text for the tooltip for this widget, which can use HTML formatting Tooltip string // Class has user-defined class name(s) used for user-dependent styling or // other misc functions. Multiple class names can be used to combine // properties: use spaces to separate per css standard Class string // Parts are a separate tree of sub-widgets that implement discrete parts // of a widget. Positions are relative to the parent widget. // These are fully managed by the parent widget Parts *Layout `copy:"-" json:"-" xml:"-" set:"-"` // Geom has the full layout geometry for size and position of this Widget Geom GeomState `edit:"-" copy:"-" json:"-" xml:"-" set:"-"` // If true, Override the computed styles and allow directly editing Style OverrideStyle bool `copy:"-" json:"-" xml:"-" set:"-"` // Styles are styling settings for this widget. // These are set in SetApplyStyle which should be called after any Config // change (e.g., as done by the Update method). See Stylers for functions // that set all of the styles, ordered from initial base defaults to later // added overrides. Styles styles.Style `copy:"-" json:"-" xml:"-" set:"-"` // Stylers are a slice of functions that are called in sequential // ascending order (so the last added styler is called last and // thus overrides all other functions) to style the element. // These should be set using Style function, which can be called // by end-user and internal code. Stylers []func(s *styles.Style) `copy:"-" json:"-" xml:"-" set:"-"` // A slice of functions to call on all widgets that are added as children // to this widget or its children. These functions are called in sequential // ascending order, so the last added one is called last and thus can // override anything set by the other ones. These should be set using // OnWidgetAdded, which can be called by both end-user and internal code. OnWidgetAdders []func(w Widget) `copy:"-" json:"-" xml:"-" set:"-"` // Listeners are event listener functions for processing events on this widget. // type specific Listeners are added in OnInit when the widget is initialized. Listeners events.Listeners `copy:"-" json:"-" xml:"-" set:"-"` // PriorityEvents has event type(s) that this widget gets sent first. // Events are sent in depth-first order, so this enables outer container // widgets to get first access to these events. PriorityEvents []events.Types `set:"-"` // CustomContextMenu is an optional context menu constructor function // called by [Widget.MakeContextMenu]. If it is set, then // it takes over full control of making the context menu for the // [events.ContextMenu] event. It can call other standard menu functions // as needed. CustomContextMenu func(m *Scene) `copy:"-" json:"-" xml:"-"` // Sc is the overall Scene to which we belong. It is automatically // by widgets whenever they are added to another widget parent. // It is passed to most Config, Layout, and Render functions as // a convenience. Sc *Scene `copy:"-" json:"-" xml:"-" set:"-"` // mutex protecting the Style field StyMu sync.RWMutex `copy:"-" view:"-" json:"-" xml:"-" set:"-"` // mutex protecting the BBox fields BBoxMu sync.RWMutex `copy:"-" view:"-" json:"-" xml:"-" set:"-"` }
WidgetBase is the base type for all Widget Widget elements, which are managed by a containing Layout, and use all 5 rendering passes. All elemental widgets must support the ReadOnly and Selected states in a reasonable way (Selected only essential when also ReadOnly), so they can function appropriately in a chooser (e.g., SliceView or TableView) -- this includes toggling selection on left mouse press.
func AsWidgetBase ¶
func AsWidgetBase(k ki.Ki) *WidgetBase
AsWidgetBase returns the given Ki object as a WidgetBase, or nil. for direct use of the return value in cases where that is needed.
func NewWidgetBase ¶
func NewWidgetBase(par ki.Ki, name ...string) *WidgetBase
NewWidgetBase adds a new WidgetBase with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*WidgetBase) AbilityIs ¶
func (wb *WidgetBase) AbilityIs(able abilities.Abilities) bool
AbilityIs returns whether the widget has the given abilities.Abilities flag set
func (*WidgetBase) AddClass ¶
func (wb *WidgetBase) AddClass(cls string) *WidgetBase
AddClass adds a CSS class name; does proper space separation
func (*WidgetBase) AddPriorityEvent ¶
func (wb *WidgetBase) AddPriorityEvent(etype events.Types)
AddPriorityEvent adds given event type to the set of priority events for this scene
func (*WidgetBase) App ¶
func (wb *WidgetBase) App() *App
App returns the App this widget is contained in
func (*WidgetBase) ApplyStyle ¶
func (wb *WidgetBase) ApplyStyle()
func (*WidgetBase) ApplyStyleParts ¶
func (wb *WidgetBase) ApplyStyleParts()
ApplyStyleParts styles the parts. Automatically called by the default ApplyStyleWidget function.
func (*WidgetBase) ApplyStylePrefs ¶
func (wb *WidgetBase) ApplyStylePrefs()
ApplyStylePrefs applies [Prefs.Spacing] and [Prefs.FontSize] to the style values for the widget.
func (*WidgetBase) ApplyStyleTree ¶
func (wb *WidgetBase) ApplyStyleTree()
ApplyStyleTree calls ApplyStyle on every Widget in the tree from me. Called during FullRender
func (*WidgetBase) ApplyStyleUpdate ¶
func (wb *WidgetBase) ApplyStyleUpdate()
ApplyStyleUpdate calls ApplyStyleTree within an UpdateRender block. This is the main call needed to ensure that state-sensitive styling is updated, when state changes.
func (*WidgetBase) ApplyStyleWidget ¶
func (wb *WidgetBase) ApplyStyleWidget()
ApplyStyleWidget is the primary styling function for all Widgets. Handles inheritance and runs the Styler functions. Must be called under a StyMu Lock
func (*WidgetBase) AsWidget ¶
func (wb *WidgetBase) AsWidget() *WidgetBase
func (*WidgetBase) BaseType ¶
func (wb *WidgetBase) BaseType() *gti.Type
func (*WidgetBase) BoxSpace ¶
func (wb *WidgetBase) BoxSpace() styles.SideFloats
BoxSpace returns the style BoxSpace value under read lock
func (*WidgetBase) CanFocus ¶
func (wb *WidgetBase) CanFocus() bool
CanFocus checks if this node can receive keyboard focus
func (*WidgetBase) Config ¶
func (wb *WidgetBase) Config()
Config is the main wrapper configuration call, calling ConfigWidget which actually does the work. Use WidgetBase.Update to update styles too, which is typically needed once an item is displayed. Config by itself is sufficient during initial construction because everything will be automatically styled during initial display.
func (*WidgetBase) ConfigPartsImpl ¶
func (wb *WidgetBase) ConfigPartsImpl(config ki.Config)
ConfigPartsImpl initializes the parts of the widget if they are not already through WidgetBase.NewParts, calls ki.Node.ConfigChildren on those parts with the given config, and then handles necessary updating logic with the given scene.
func (*WidgetBase) ConfigTree ¶
func (wb *WidgetBase) ConfigTree()
ConfigTree calls Config on every Widget in the tree from me.
func (*WidgetBase) ConfigWidget ¶
func (wb *WidgetBase) ConfigWidget()
ConfigWidget is the interface method called by Config that should be defined for each Widget type, which actually does the configuration work.
func (*WidgetBase) ContainsFocus ¶
func (wb *WidgetBase) ContainsFocus() bool
ContainsFocus returns true if this widget contains the current focus widget as maintained in the RenderWin
func (*WidgetBase) ContextMenu ¶
func (wb *WidgetBase) ContextMenu(m *Scene)
func (*WidgetBase) ContextMenuPos ¶
func (wb *WidgetBase) ContextMenuPos(e events.Event) image.Point
ContextMenuPos returns the default position for the context menu upper left corner. The event will be from a mouse ContextMenu event if non-nil: should handle both cases.
func (*WidgetBase) CopyFieldsFrom ¶
func (wb *WidgetBase) CopyFieldsFrom(frm any)
func (*WidgetBase) DeleteParts ¶
func (wb *WidgetBase) DeleteParts()
func (*WidgetBase) Destroy ¶
func (wb *WidgetBase) Destroy()
func (*WidgetBase) DirectWinUpload ¶
func (wb *WidgetBase) DirectWinUpload()
func (*WidgetBase) DoNeedsRender ¶
func (wb *WidgetBase) DoNeedsRender()
DoNeedsRender calls Render on tree from me for nodes with NeedsRender flags set
func (*WidgetBase) EventMgr ¶
func (wb *WidgetBase) EventMgr() *EventMgr
func (*WidgetBase) FlagType ¶
func (wb *WidgetBase) FlagType() enums.BitFlagSetter
func (*WidgetBase) FocusClear ¶
func (wb *WidgetBase) FocusClear()
FocusClear resets focus to nil, but keeps the previous focus to pick up next time..
func (*WidgetBase) FocusNext ¶
func (wb *WidgetBase) FocusNext()
FocusNext moves the focus onto the next item
func (*WidgetBase) FocusPrev ¶
func (wb *WidgetBase) FocusPrev()
FocusPrev moves the focus onto the previous item
func (*WidgetBase) FocusableInMe ¶
func (wb *WidgetBase) FocusableInMe() Widget
FocusableInMe returns the first Focusable element within this widget
func (*WidgetBase) GrowToAlloc ¶
func (wb *WidgetBase) GrowToAlloc() bool
GrowToAlloc grows our Actual size up to current Alloc size for any dimension with a non-zero Grow factor. If Grow is < 1, then the size is increased in proportion, but any factor > 1 produces a full fill along that dimension. Returns true if this resulted in a change in our Total size.
func (*WidgetBase) GrowToAllocSize ¶
func (wb *WidgetBase) GrowToAllocSize(act, alloc mat32.Vec2) (mat32.Vec2, bool)
GrowToAllocSize returns the potential size that widget could grow, for any dimension with a non-zero Grow factor. If Grow is < 1, then the size is increased in proportion, but any factor > 1 produces a full fill along that dimension. Returns true if this resulted in a change.
func (*WidgetBase) HandleClickOnEnterSpace ¶
func (wb *WidgetBase) HandleClickOnEnterSpace()
HandleClickOnEnterSpace adds key event handler for Enter or Space to generate a Click action. This is not added by default, but is added in Button and Switch Widgets for example.
func (*WidgetBase) HandleEvent ¶
func (wb *WidgetBase) HandleEvent(ev events.Event)
HandleEvent sends the given event to all Listeners for that event type. It also checks if the State has changed and calls ApplyStyle if so. If more significant Config level changes are needed due to an event, the event handler must do this itself.
func (*WidgetBase) HandleEvents ¶
func (wb *WidgetBase) HandleEvents()
HandleEvents sets the default WidgetBase event handlers
func (*WidgetBase) HandleLongHoverTooltip ¶
func (wb *WidgetBase) HandleLongHoverTooltip()
HandleLongHoverTooltip listens for LongHover and LongPress events and pops up and deletes tooltips based on those. Most widgets should call this as part of their event handler methods.
func (*WidgetBase) HandleSelectToggle ¶
func (wb *WidgetBase) HandleSelectToggle()
HandleSelectToggle does basic selection handling logic on widget, as just a toggle on individual selection state, including ensuring consistent selection flagging for parts. This is not called by WidgetBase but should be called for simple Widget types. More complex container / View widgets likely implement their own more complex selection logic.
func (*WidgetBase) HandleWidgetClick ¶
func (wb *WidgetBase) HandleWidgetClick()
HandleWidgetClick handles the Click event for basic Widget behavior. For Left button: If Checkable, toggles Checked. if Focusable, Focuses or clears, If Selectable, updates state and sends Select, Deselect.
func (*WidgetBase) HandleWidgetContextMenu ¶
func (wb *WidgetBase) HandleWidgetContextMenu()
func (*WidgetBase) HandleWidgetMagnify ¶
func (wb *WidgetBase) HandleWidgetMagnify()
HandleWidgetMagnifyEvent updates [Prefs.Zoom] on events.Magnify
func (*WidgetBase) HandleWidgetStateFromFocus ¶
func (wb *WidgetBase) HandleWidgetStateFromFocus()
HandleWidgetStateFromFocus updates standard State flags based on Focus events
func (*WidgetBase) HandleWidgetStateFromMouse ¶
func (wb *WidgetBase) HandleWidgetStateFromMouse()
HandleWidgetStateFromMouse updates all standard State flags based on mouse events, such as MouseDown / Up -> Active and MouseEnter / Leave -> Hovered. None of these "consume" the event by setting Handled flag, as they are designed to work in conjunction with more specific handlers. Note that Disabled and Invisible widgets do NOT receive these events so it is not necessary to check that.
func (*WidgetBase) HasClass ¶
func (wb *WidgetBase) HasClass(cls string) bool
HasClass returns whether the node has the given class name as one of its classes.
func (*WidgetBase) HasFlagWithin ¶
func (wb *WidgetBase) HasFlagWithin(flag enums.BitFlag) bool
HasFlagWithin returns whether the current node or any of its children have the given flag.
func (*WidgetBase) HasSc ¶
func (wb *WidgetBase) HasSc() bool
HasSc checks that the Sc Scene has been set. Called prior to using -- logs an error if not.
func (*WidgetBase) HasStateWithin ¶
func (wb *WidgetBase) HasStateWithin(state states.States) bool
HasStateWithin returns whether the current node or any of its children have the given state flag.
func (*WidgetBase) IsDirectWinUpload ¶
func (wb *WidgetBase) IsDirectWinUpload() bool
func (*WidgetBase) IsDisabled ¶
func (wb *WidgetBase) IsDisabled() bool
IsDisabled tests if this node is flagged as [Disabled]. If so, behave and style appropriately.
func (*WidgetBase) IsFirstChild ¶
func (wb *WidgetBase) IsFirstChild() bool
IsFirstChild returns whether the node is the first child of its parent
func (*WidgetBase) IsLastChild ¶
func (wb *WidgetBase) IsLastChild() bool
IsLastChild returns whether the node is the last child of its parent
func (*WidgetBase) IsNthChild ¶
func (wb *WidgetBase) IsNthChild(n int) bool
IsNthChild returns whether the node is nth-child of its parent
func (*WidgetBase) IsOnlyChild ¶
func (wb *WidgetBase) IsOnlyChild() bool
IsOnlyChild returns whether the node is the only child of its parent
func (*WidgetBase) IsReadOnly ¶
func (wb *WidgetBase) IsReadOnly() bool
IsReadOnly tests if this node is flagged as [ReadOnly] or [Disabled]. If so, behave appropriately. Styling is based on each state separately, but behaviors are often the same for both of these states.
func (*WidgetBase) IsVisible ¶
func (wb *WidgetBase) IsVisible() bool
IsVisible returns true if a node is visible for rendering according to the states.Invisible flag on it or any of its parents. This flag is also set by styles.DisplayNone during [ApplyStyle]. This does *not* check for an empty TotalBBox, indicating that the widget is out of render range -- that is done by [PushBounds] prior to rendering. Non-visible nodes are automatically not rendered and do not get window events. This call recursively calls the parent, which is typically a short path.
func (*WidgetBase) KiType ¶
func (t *WidgetBase) KiType() *gti.Type
KiType returns the *gti.Type of WidgetBase
func (*WidgetBase) NeedsRebuild ¶
func (wb *WidgetBase) NeedsRebuild() bool
NeedsRebuild returns true if the RenderContext indicates a full rebuild is needed.
func (*WidgetBase) NewParts ¶
func (wb *WidgetBase) NewParts() *Layout
NewParts makes the Parts layout if not already there, with given layout orientation
func (*WidgetBase) On ¶
func (wb *WidgetBase) On(etype events.Types, fun func(e events.Event)) *WidgetBase
On adds an event listener function for the given event type, to the end of the current stack, so that it will be called before everything else already on the stack.
func (*WidgetBase) OnAdd ¶
func (wb *WidgetBase) OnAdd()
OnAdd is called when widgets are added to a parent. It sets the scene of the widget to its widget parent. It should be called by all other OnAdd functions defined by widget types.
func (*WidgetBase) OnChange ¶
func (wb *WidgetBase) OnChange(fun func(e events.Event)) *WidgetBase
OnChange adds an event listener function for events.Change events
func (*WidgetBase) OnChildAdded ¶
func (wb *WidgetBase) OnChildAdded(child ki.Ki)
func (*WidgetBase) OnClick ¶
func (wb *WidgetBase) OnClick(fun func(e events.Event)) *WidgetBase
OnClick adds an event listener function for events.Click events
func (*WidgetBase) OnClose ¶
func (wb *WidgetBase) OnClose(fun func(e events.Event)) *WidgetBase
OnClose adds an event listener function for events.Close events on the widget's Scene. Directly listening to Close events for non-scene widgets does not work, so it must go through the Scene.
func (*WidgetBase) OnDoubleClick ¶
func (wb *WidgetBase) OnDoubleClick(fun func(e events.Event)) *WidgetBase
OnDoubleClick adds an event listener function for events.DoubleClick events
func (*WidgetBase) OnFocus ¶
func (wb *WidgetBase) OnFocus(fun func(e events.Event)) *WidgetBase
OnFocus adds an event listener function for events.Focus events
func (*WidgetBase) OnFocusLost ¶
func (wb *WidgetBase) OnFocusLost(fun func(e events.Event)) *WidgetBase
OnFocusLost adds an event listener function for events.FocusLost events
func (*WidgetBase) OnInit ¶
func (wb *WidgetBase) OnInit()
OnInit for WidgetBase is not called by the usual ki mechanism, but should be called by every Widget type in its own OnInit to establish all the default styling and event handling that applies to all widgets.
func (*WidgetBase) OnInput ¶
func (wb *WidgetBase) OnInput(fun func(e events.Event)) *WidgetBase
OnInput adds an event listener function for events.Input events
func (*WidgetBase) OnKeyChord ¶
func (wb *WidgetBase) OnKeyChord(fun func(e events.Event)) *WidgetBase
OnKeyChord adds an event listener function for events.KeyChord events
func (*WidgetBase) OnLast ¶
OnLast adds an event listener function for the given event type, to the start of the current stack, so that it will be called after everything else already on the stack.
func (*WidgetBase) OnSelect ¶
func (wb *WidgetBase) OnSelect(fun func(e events.Event)) *WidgetBase
OnSelect adds an event listener function for events.Select events
func (*WidgetBase) OnShow ¶
func (wb *WidgetBase) OnShow(fun func(e events.Event)) *WidgetBase
OnShow adds an event listener function for events.Show events on the widget's Scene. Directly listening to Show events for non-scene widgets does not work, so it must go through the Scene. This must typically be called in OnAdd() or later, and definitely NOT in OnInit, because only then will the Scene be set.
func (*WidgetBase) OnWidgetAdded ¶
func (wb *WidgetBase) OnWidgetAdded(fun func(w Widget)) *WidgetBase
OnWidgetAdded adds a function to call when a widget is added as a child to the widget or any of its children.
func (*WidgetBase) ParentActualBackground ¶
func (wb *WidgetBase) ParentActualBackground() image.Image
ParentActualBackground returns the actual background of the parent of the widget. If it has no parent, it returns nil.
func (*WidgetBase) ParentLayout ¶
func (wb *WidgetBase) ParentLayout() *Layout
ParentLayout returns the parent layout
func (*WidgetBase) ParentScrollLayout ¶
func (wb *WidgetBase) ParentScrollLayout() *Layout
ParentScrollLayout returns the parent layout that has active scrollbars
func (*WidgetBase) ParentWidget ¶
func (wb *WidgetBase) ParentWidget() (Widget, *WidgetBase)
ParentWidget returns the parent as a (Widget, *WidgetBase) or nil if this is the root and has no parent.
func (*WidgetBase) ParentWidgetIf ¶
func (wb *WidgetBase) ParentWidgetIf(fun func(p *WidgetBase) bool) (Widget, *WidgetBase)
ParentWidgetIf returns the nearest widget parent of the widget for which the given function returns true. It returns nil if no such parent is found; see [ParentWidgetIfTry] for a version with an error.
func (*WidgetBase) ParentWidgetIfTry ¶
func (wb *WidgetBase) ParentWidgetIfTry(fun func(p *WidgetBase) bool) (Widget, *WidgetBase, error)
ParentWidgetIfTry returns the nearest widget parent of the widget for which the given function returns true. It returns an error if no such parent is found; see [ParentWidgetIf] for a version without an error.
func (*WidgetBase) PointToRelPos ¶
func (wb *WidgetBase) PointToRelPos(pt image.Point) image.Point
PointToRelPos translates a point in Scene pixel coords into relative position within node, based on the Content BBox
func (*WidgetBase) PopBounds ¶
func (wb *WidgetBase) PopBounds()
PopBounds pops our bounding-box bounds -- last step in Render after rendering children
func (*WidgetBase) PosInScBBox ¶
func (wb *WidgetBase) PosInScBBox(pos image.Point) bool
PosInScBBox returns true if given position is within this node's scene bbox (under read lock)
func (*WidgetBase) Position ¶
func (wb *WidgetBase) Position()
Position uses the final sizes to set relative positions within layouts according to alignment settings.
func (*WidgetBase) PositionChildren ¶
func (wb *WidgetBase) PositionChildren()
PositionChildren runs Position on the children
func (*WidgetBase) PositionParts ¶
func (wb *WidgetBase) PositionParts()
func (*WidgetBase) PositionWidget ¶
func (wb *WidgetBase) PositionWidget()
func (*WidgetBase) PositionWithinAllocMainX ¶
func (wb *WidgetBase) PositionWithinAllocMainX(pos mat32.Vec2, parJustify, parAlign styles.Aligns)
func (*WidgetBase) PositionWithinAllocMainY ¶
func (wb *WidgetBase) PositionWithinAllocMainY(pos mat32.Vec2, parJustify, parAlign styles.Aligns)
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 Render returns whether the new bounds are empty or not -- if empty then don't render!
func (*WidgetBase) Render ¶
func (wb *WidgetBase) Render()
Render performs rendering on widget and parts, but not Children for the base type, which does not manage children (see Layout).
func (*WidgetBase) RenderBoxImpl ¶
func (wb *WidgetBase) RenderBoxImpl(pos mat32.Vec2, sz mat32.Vec2, bs styles.Border)
RenderBoxImpl implements the standard box model rendering -- assumes all paint params have already been set
func (*WidgetBase) RenderChildren ¶
func (wb *WidgetBase) RenderChildren()
RenderChildren renders all of node's children.
func (*WidgetBase) RenderLock ¶
func (wb *WidgetBase) RenderLock() (*paint.Context, *styles.Style)
RenderLock returns the locked paint.Context and styles.Style with StyMu locked. This should be called at start of widget-level rendering, and should always be associated with a corresponding WidgetBase.RenderUnlock.
func (*WidgetBase) RenderParts ¶
func (wb *WidgetBase) RenderParts()
func (*WidgetBase) RenderStdBox ¶
func (wb *WidgetBase) RenderStdBox(st *styles.Style)
RenderStdBox draws standard box using given style. paint.State and Style must already be locked at this point (RenderLock)
func (*WidgetBase) RenderUnlock ¶
func (wb *WidgetBase) RenderUnlock()
RenderUnlock unlocks the widget's associated paint.Context and StyMu. This should be called at the end of widget-level rendering, and should always be associated with a corresponding WidgetBase.RenderLock.
func (*WidgetBase) ResetStyleWidget ¶
func (wb *WidgetBase) ResetStyleWidget()
ResetStyleWidget resets the widget styles and applies the basic default styles specified in styles.Style.Defaults. It is called automatically in [ApplyStyleWidget] and should not need to be called by end-user code.
func (*WidgetBase) RunStylers ¶
func (wb *WidgetBase) RunStylers()
RunStylers runs the style functions specified in the StyleFuncs field in sequential ascending order.
func (*WidgetBase) ScenePos ¶
func (wb *WidgetBase) ScenePos()
ScenePos computes scene-based absolute positions and final BBox bounding boxes for rendering, based on relative positions from Position step and parents accumulated position and scroll offset. This is the only step needed when scrolling (very fast).
func (*WidgetBase) ScenePosChildren ¶
func (wb *WidgetBase) ScenePosChildren()
ScenePosChildren runs ScenePos on the children
func (*WidgetBase) ScenePosParts ¶
func (wb *WidgetBase) ScenePosParts()
func (*WidgetBase) ScenePosWidget ¶
func (wb *WidgetBase) ScenePosWidget()
func (*WidgetBase) ScrollToMe ¶
func (wb *WidgetBase) ScrollToMe() bool
ScrollToMe tells my parent layout (that has scroll bars) to scroll to keep this widget in view -- returns true if scrolled
func (*WidgetBase) Send ¶
func (wb *WidgetBase) Send(typ events.Types, orig ...events.Event)
Send sends an NEW event of given type to this widget, optionally starting from values in the given original event (recommended to include where possible). Do NOT send an existing event using this method if you want the Handled state to persist throughout the call chain; call HandleEvent directly for any existing events.
func (*WidgetBase) SendChange ¶
func (wb *WidgetBase) SendChange(orig ...events.Event)
SendChange sends the events.Change event, which is widely used to signal updating for most widgets. It takes the event that the new change event is derived from, if any.
func (*WidgetBase) SendKeyChord ¶
func (wb *WidgetBase) SendKeyChord(kc key.Chord, orig ...events.Event)
func (*WidgetBase) SendKeyChordRune ¶
func (*WidgetBase) SendKeyFun ¶
func (wb *WidgetBase) SendKeyFun(kf keyfun.Funs, orig ...events.Event)
func (*WidgetBase) SetAbilities ¶
func (wb *WidgetBase) SetAbilities(on bool, able ...abilities.Abilities) *WidgetBase
SetAbilities sets the given abilities.Abilities flags to the given value
func (*WidgetBase) SetBBoxes ¶
func (wb *WidgetBase) SetBBoxes()
func (*WidgetBase) SetBBoxesFromAllocs ¶
func (wb *WidgetBase) SetBBoxesFromAllocs()
SetBBoxesFromAllocs sets BBox and ContentBBox from Geom.Pos and .Size This does NOT intersect with parent content BBox, which is done in SetBBoxes. Use this for elements that are dynamically positioned outside of parent BBox.
func (*WidgetBase) SetClass ¶
func (t *WidgetBase) SetClass(v string) *WidgetBase
SetClass sets the [WidgetBase.Class]: Class has user-defined class name(s) used for user-dependent styling or other misc functions. Multiple class names can be used to combine properties: use spaces to separate per css standard
func (*WidgetBase) SetContentPosFromPos ¶
func (wb *WidgetBase) SetContentPosFromPos()
SetContentPosFromPos sets the Pos.Content position based on current Pos plus the BoxSpace position offset.
func (*WidgetBase) SetCustomContextMenu ¶
func (t *WidgetBase) SetCustomContextMenu(v func(m *Scene)) *WidgetBase
SetCustomContextMenu sets the [WidgetBase.CustomContextMenu]: CustomContextMenu is an optional context menu constructor function called by [Widget.MakeContextMenu]. If it is set, then it takes over full control of making the context menu for the events.ContextMenu event. It can call other standard menu functions as needed.
func (*WidgetBase) SetEnabled ¶
func (wb *WidgetBase) SetEnabled(enabled bool) *WidgetBase
SetEnabled sets the Disabled flag
func (*WidgetBase) SetFocus ¶
func (wb *WidgetBase) SetFocus()
SetFocus sets 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). This does NOT send an events.Focus event, which typically results in the widget being styled as focused. See [SetFocusEvent] for one that does.
func (*WidgetBase) SetFocusEvent ¶
func (wb *WidgetBase) SetFocusEvent()
SetFocusEvent sets 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). This sends an events.Focus event, which typically results in the widget being styled as focused. See [SetFocus] for one that does not.
func (*WidgetBase) SetNeedsLayout ¶
func (wb *WidgetBase) SetNeedsLayout(updt bool)
SetNeedsLayoutUpdate sets the ScNeedsLayout flag if updt is true. See UpdateEndLayout for convenience method. This should be called after widget Config call _after_ calling UpdateEnd(updt) and passing that same updt flag from UpdateStart.
func (*WidgetBase) SetNeedsRender ¶
func (wb *WidgetBase) SetNeedsRender(updt bool)
SetNeedsRender sets the NeedsRender and Scene NeedsRender flags, if updt is true. See [UpdateEndRender] for convenience method. This should be called after widget state changes that don't need styling, e.g., in event handlers or other update code, _after_ calling UpdateEnd(updt) and passing that same updt flag from UpdateStart.
func (*WidgetBase) SetPosFromParent ¶
func (wb *WidgetBase) SetPosFromParent()
func (*WidgetBase) SetReadOnly ¶
func (wb *WidgetBase) SetReadOnly(ro bool) *WidgetBase
SetReadOnly sets the ReadOnly state flag to given value
func (*WidgetBase) SetScene ¶
func (wb *WidgetBase) SetScene(sc *Scene)
SetScene sets the Scene pointer for this widget and all of its children. This can be necessary when creating widgets outside the usual "NewWidget" paradigm, e.g., when reading from a JSON file.
func (*WidgetBase) SetSelected ¶
func (wb *WidgetBase) SetSelected(sel bool)
SetSelected sets the Selected flag to given value for the entire Widget and calls ApplyStyleTree to apply any style changes.
func (*WidgetBase) SetState ¶
func (wb *WidgetBase) SetState(on bool, state ...states.States) *WidgetBase
SetState sets the given states.State flags to the given value
func (*WidgetBase) SetStyles ¶
func (wb *WidgetBase) SetStyles()
SetStyles sets the base, widget-universal default style function that applies to all widgets. It is added and called first in the styling order. Because it handles default styling in response to State flags such as Disabled and Selected, these state flags must be set prior to calling this. Use [StyleFirst] to add a function that is called prior to this, to update state flags.
func (*WidgetBase) SetTooltip ¶
func (t *WidgetBase) SetTooltip(v string) *WidgetBase
SetTooltip sets the [WidgetBase.Tooltip]: text for the tooltip for this widget, which can use HTML formatting
func (*WidgetBase) ShowContextMenu ¶
func (wb *WidgetBase) ShowContextMenu(e events.Event)
func (*WidgetBase) SizeDown ¶
func (wb *WidgetBase) SizeDown(iter int) bool
SizeDown (top-down, multiple iterations possible) provides top-down size allocations based initially on Scene available size and the SizeUp Actual sizes. If there is extra space available, it is allocated according to the Grow factors. Flexible elements (e.g., Flex Wrap layouts and Label with word wrap) update their Actual size based on available Alloc size (re-wrap), to fit the allocated shape vs. the initial bottom-up guess. However, do NOT grow the Actual size to match Alloc at this stage, as Actual sizes must always represent the minimums (see Position). Returns true if any change in Actual size occurred.
func (*WidgetBase) SizeDownChildren ¶
func (wb *WidgetBase) SizeDownChildren(iter int) bool
SizeDownChildren calls SizeDown on the Children. The kids must have their Size.Alloc set prior to this, which is what Layout type does. Other special widget types can do custom layout and call this too.
func (*WidgetBase) SizeDownParts ¶
func (wb *WidgetBase) SizeDownParts(iter int) bool
func (*WidgetBase) SizeDownWidget ¶
func (wb *WidgetBase) SizeDownWidget(iter int) bool
SizeDownWidget is the standard widget implementation of SizeDown. It just delegates to the Parts.
func (*WidgetBase) SizeFinal ¶
func (wb *WidgetBase) SizeFinal()
SizeFinal: (bottom-up) similar to SizeUp but done at the end of the Sizing phase: first grows widget Actual sizes based on their Grow factors, up to their Alloc sizes. Then gathers this updated final actual Size information for layouts to register their actual sizes prior to positioning, which requires accurate Actual vs. Alloc sizes to perform correct alignment calculations.
func (*WidgetBase) SizeFinalChildren ¶
func (wb *WidgetBase) SizeFinalChildren()
SizeFinalChildren calls SizeFinal on all the children of this node
func (*WidgetBase) SizeFinalParts ¶
func (wb *WidgetBase) SizeFinalParts()
SizeFinalParts adjusts the Content size to hold the Parts Final sizes
func (*WidgetBase) SizeFinalWidget ¶
func (wb *WidgetBase) SizeFinalWidget()
SizeFinalWidget is the standard Widget SizeFinal pass
func (*WidgetBase) SizeFromStyle ¶
func (wb *WidgetBase) SizeFromStyle()
SizeFromStyle sets the initial Actual Sizes from Style.Min, Max. Required first call in SizeUp.
func (*WidgetBase) SizeUp ¶
func (wb *WidgetBase) SizeUp()
SizeUp (bottom-up) gathers Actual sizes from our Children & Parts, based on Styles.Min / Max sizes and actual content sizing (e.g., text size). Flexible elements (e.g., Label, Flex Wrap, TopAppBar) should reserve the _minimum_ size possible at this stage, and then Grow based on SizeDown allocation.
func (*WidgetBase) SizeUpChildren ¶
func (wb *WidgetBase) SizeUpChildren()
SizeUpChildren calls SizeUp on all the children of this node
func (*WidgetBase) SizeUpParts ¶
func (wb *WidgetBase) SizeUpParts()
SizeUpParts adjusts the Content size to hold the Parts layout if present
func (*WidgetBase) SizeUpWidget ¶
func (wb *WidgetBase) SizeUpWidget()
SizeUpWidget is the standard Widget SizeUp pass
func (*WidgetBase) SpaceFromStyle ¶
func (wb *WidgetBase) SpaceFromStyle()
SpaceFromStyle sets the Space based on Style BoxSpace().Size()
func (*WidgetBase) StartFocus ¶
func (wb *WidgetBase) StartFocus()
StartFocus specifies this widget to give focus to when the window opens
func (*WidgetBase) StateIs ¶
func (wb *WidgetBase) StateIs(state states.States) bool
StateIs returns whether the widget has the given states.States flag set
func (*WidgetBase) Style ¶
func (wb *WidgetBase) Style(s func(s *styles.Style)) *WidgetBase
Style adds the given styler to the widget's stylers. It is the main way for both end-user and internal code to set the styles of a widget. It should only be done before showing the scene during initial configuration -- otherwise requires a StyMu mutex lock.
func (*WidgetBase) StyleFirst ¶
func (wb *WidgetBase) StyleFirst(s func(s *styles.Style)) *WidgetBase
StyleFirst inserts the given styler at the start of the widget's stylers, ensuring that it is run first, before even the WidgetBase default styler. This is useful for any functions that update widget state flags based on other variables, so that these are reflected in the base styling function that updates styles based on state.
func (*WidgetBase) StyleRLock ¶
func (wb *WidgetBase) StyleRLock()
StyleRLock does a read-lock for reading the style
func (*WidgetBase) StyleRUnlock ¶
func (wb *WidgetBase) StyleRUnlock()
StyleRUnlock unlocks the read-lock
func (*WidgetBase) StyleSizeUpdate ¶
func (wb *WidgetBase) StyleSizeUpdate() bool
StyleSizeUpdate updates styling size values for widget and its parent, which should be called after these are updated. Returns true if any changed.
func (*WidgetBase) Transition ¶
func (wb *WidgetBase) Transition(value any, to any, duration time.Duration, timingFunc func(prop float32) float32)
Transition transitions the given pointer value (typically a pointer to a style property that is a number, unit value, or color) to the given destination value (typically not a pointer) over the given duration, using the given timing function. The timing function takes the proportion of the time of the transition that has taken place (0-1) and returns the total proportion of the difference between the starting and ending value that should be applied at that point in time (0-1). For example, a standard linear timing function would just return the value it gets. The transition runs at the FPS of the window, and it tells the widget to render on every FPS tick. If the starting and ending value are the same, it does nothing. If not, it runs the transition in a separate goroutine.
func (*WidgetBase) Update ¶
func (wb *WidgetBase) Update()
Update calls Config and then ApplyStyle on every Widget in the tree from me. This should be used after any structural changes to currently-displayed widgets. It wraps everything in UpdateStart / UpdateEndRender so node will render on next pass. Call SetNeedsLayout to also trigger a layout where needed.
func (*WidgetBase) UpdateEndAsync ¶
func (wb *WidgetBase) UpdateEndAsync(updt bool)
UpdateEndAsync must be called after [UpdateStartAsync] for any asynchronous update that happens outside of the usual user event-driven, same-thread updates.
func (*WidgetBase) UpdateEndAsyncLayout ¶
func (wb *WidgetBase) UpdateEndAsyncLayout(updt bool)
UpdateEndAsyncLayout should be called instead of [UpdateEndAsync] for any [UpdateStartAsync] / [UpdateEndAsync] block that needs a re-layout at the end. Just does [SetNeedsLayoutUpdate] after UpdateEnd, and uses the cached wb.Sc pointer.
func (*WidgetBase) UpdateEndAsyncRender ¶
func (wb *WidgetBase) UpdateEndAsyncRender(updt bool)
UpdateEndAsyncRender should be called instead of [UpdateEndAsync] for any [UpdateStartAsync] / [UpdateEndAsync] block that needs a re-render at the end. Just does [SetNeedsRenderUpdate] after UpdateEnd, and uses the cached wb.Sc pointer.
func (*WidgetBase) UpdateEndLayout ¶
func (wb *WidgetBase) UpdateEndLayout(updt bool)
UpdateEndLayout should be called instead of UpdateEnd for any UpdateStart / UpdateEnd block that needs a re-layout at the end. Just does SetNeedsLayout after UpdateEnd, and uses the cached wb.Sc pointer.
func (*WidgetBase) UpdateEndRender ¶
func (wb *WidgetBase) UpdateEndRender(updt bool)
UpdateEndRender should be called instead of UpdateEnd for any [UpdateStart] / [UpdateEnd] block that needs a re-render at the end. Just does [SetNeedsRenderUpdate] after UpdateEnd, and uses the cached wb.Sc pointer.
func (*WidgetBase) UpdateStartAsync ¶
func (wb *WidgetBase) UpdateStartAsync() bool
UpdateStartAsync must be called for any asynchronous update that happens outside of the usual user event-driven, same-thread updates, or other updates that can happen during standard layout / rendering. It waits for any current Render update to finish, via RenderCtx().ReadLock(). It must be paired with an UpdateEndAsync. These calls CANNOT be triggered during a standard render update, (whereas UpdateStart / End can be, and typically are) because it will cause a hang on the Read Lock which was already write locked at the start of the render.
func (*WidgetBase) VisibleKidsIter ¶
func (wb *WidgetBase) VisibleKidsIter(fun func(i int, kwi Widget, kwb *WidgetBase) bool)
VisibleKidsIter iterates through the Kids, as widgets, calling the given function, excluding any with the *local* states.Invisible flag set (does not check parents). This is used e.g., for layout functions to exclude non-visible direct children. Return ki.Continue (true) to continue, and ki.Break (false) to terminate.
func (*WidgetBase) WalkPreNode ¶
func (wb *WidgetBase) WalkPreNode(fun func(ki.Ki) bool)
WalkPreNode extends WalkPre to Parts -- key for getting full Update protection!
func (*WidgetBase) WidgetKidsIter ¶
func (wb *WidgetBase) WidgetKidsIter(fun func(i int, kwi Widget, kwb *WidgetBase) bool)
WidgetKidsIter iterates through the Kids, as widgets, calling the given function. Return ki.Continue (true) to continue, and ki.Break (false) to terminate.
func (*WidgetBase) WidgetNextVisible ¶
func (wb *WidgetBase) WidgetNextVisible() (Widget, *WidgetBase)
WidgetNextVisible returns the next visible node in the tree as a Widget, nil if no more.
func (*WidgetBase) WidgetPrevVisible ¶
func (wb *WidgetBase) WidgetPrevVisible() (Widget, *WidgetBase)
WidgetPrevVisible returns the previous visible node in the tree as a Widget, nil if no more.
func (*WidgetBase) WidgetWalkPre ¶
func (wb *WidgetBase) WidgetWalkPre(fun func(kwi Widget, kwb *WidgetBase) bool)
WidgetWalkPre is a version of the ki WalkPre iterator that automatically filters nil or deleted items and operates on Widget types. Return ki.Continue (true) to continue, and ki.Break (false) to terminate.
func (*WidgetBase) WinBBox ¶
func (wb *WidgetBase) WinBBox() image.Rectangle
WinBBox returns the RenderWin based bounding box for the widget by adding the Scene position to the ScBBox
type WidgetFlags ¶
type WidgetFlags ki.Flags //enums:bitflag
WidgetFlags define Widget node bitflags for tracking common high-frequency GUI state, mostly having to do with event processing. Extends ki.Flags
const ( // NeedsRender needs to be rendered on next render iteration NeedsRender WidgetFlags = WidgetFlags(ki.FlagsN) + iota )
const WidgetFlagsN WidgetFlags = 8
WidgetFlagsN is the highest valid value for type WidgetFlags, plus one.
func WidgetFlagsValues ¶
func WidgetFlagsValues() []WidgetFlags
WidgetFlagsValues returns all possible values for the type WidgetFlags.
func (WidgetFlags) BitIndexString ¶
func (i WidgetFlags) BitIndexString() string
BitIndexString returns the string representation of this WidgetFlags value if it is a bit index value (typically an enum constant), and not an actual bit flag value.
func (WidgetFlags) Desc ¶
func (i WidgetFlags) Desc() string
Desc returns the description of the WidgetFlags value.
func (WidgetFlags) HasFlag ¶
func (i WidgetFlags) HasFlag(f enums.BitFlag) bool
HasFlag returns whether these bit flags have the given bit flag set.
func (WidgetFlags) Int64 ¶
func (i WidgetFlags) Int64() int64
Int64 returns the WidgetFlags value as an int64.
func (WidgetFlags) IsValid ¶
func (i WidgetFlags) IsValid() bool
IsValid returns whether the value is a valid option for type WidgetFlags.
func (WidgetFlags) MarshalText ¶
func (i WidgetFlags) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (*WidgetFlags) SetFlag ¶
func (i *WidgetFlags) SetFlag(on bool, f ...enums.BitFlag)
SetFlag sets the value of the given flags in these flags to the given value.
func (*WidgetFlags) SetInt64 ¶
func (i *WidgetFlags) SetInt64(in int64)
SetInt64 sets the WidgetFlags value from an int64.
func (*WidgetFlags) SetString ¶
func (i *WidgetFlags) SetString(s string) error
SetString sets the WidgetFlags value from its string representation, and returns an error if the string is invalid.
func (*WidgetFlags) SetStringOr ¶
func (i *WidgetFlags) SetStringOr(s string) error
SetStringOr sets the WidgetFlags value from its string representation while preserving any bit flags already set, and returns an error if the string is invalid.
func (WidgetFlags) String ¶
func (i WidgetFlags) String() string
String returns the string representation of this WidgetFlags value.
func (*WidgetFlags) UnmarshalText ¶
func (i *WidgetFlags) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (WidgetFlags) Values ¶
func (i WidgetFlags) Values() []enums.Enum
Values returns all possible values for the type WidgetFlags.
type WinFlags ¶
type WinFlags int64 //enums:bitflag -trim-prefix Win
WinFlags represent RenderWin state
const ( // WinHasGeomPrefs indicates if this window has WinGeomPrefs setting that // sized it -- affects whether other default geom should be applied. WinHasGeomPrefs WinFlags = iota // WinClosing is atomic flag indicating window is closing WinClosing // WinResizing is atomic flag indicating window is resizing WinResizing // WinGotFocus indicates that have we received RenderWin focus WinGotFocus // WinSentShow have we sent the show event yet? Only ever sent ONCE WinSentShow // WinGoLoop true if we are running from GoStartEventLoop -- requires a WinWait.Done at end WinGoLoop // WinStopEventLoop is set when event loop stop is requested WinStopEventLoop // WinSelectionMode indicates that the window is in GoGi inspect editor edit mode WinSelectionMode )
const WinFlagsN WinFlags = 8
WinFlagsN is the highest valid value for type WinFlags, plus one.
func WinFlagsValues ¶
func WinFlagsValues() []WinFlags
WinFlagsValues returns all possible values for the type WinFlags.
func (WinFlags) BitIndexString ¶
BitIndexString returns the string representation of this WinFlags value if it is a bit index value (typically an enum constant), and not an actual bit flag value.
func (WinFlags) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*WinFlags) SetFlag ¶
SetFlag sets the value of the given flags in these flags to the given value.
func (*WinFlags) SetString ¶
SetString sets the WinFlags value from its string representation, and returns an error if the string is invalid.
func (*WinFlags) SetStringOr ¶
SetStringOr sets the WinFlags value from its string representation while preserving any bit flags already set, and returns an error if the string is invalid.
func (*WinFlags) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type WinGeomPrefs ¶
type WinGeomPrefs map[string]map[string]RenderWinGeom
WinGeomPrefs is the data structure for recording the window geometry by window name, screen name.
type WinGeomPrefsMgr ¶
type WinGeomPrefsMgr struct { // the full set of window geometries Geoms WinGeomPrefs // temporary cached geometries -- saved to Geoms after SaveDelay Cache WinGeomPrefs // base name of the preferences file in GoGi prefs directory FileName string // when prefs were last saved -- if we weren't the last to save, then we need to re-open before modifying LastSave time.Time // if true, we are setting geometry so don't save -- caller must call SettingStart() SettingEnd() to block SettingNoSave bool // read-write mutex that protects updating of WinGeomPrefs Mu sync.RWMutex // wait time before trying to lock file again LockSleep time.Duration // wait time before saving the Cache into Geoms SaveDelay time.Duration // contains filtered or unexported fields }
WinGeomPrefsMgr is the manager of window geometry preferences. Records window geometry in a persistent file, used when opening new windows.
func (*WinGeomPrefsMgr) AbortSave ¶
func (mgr *WinGeomPrefsMgr) AbortSave()
AbortSave cancels any pending saving of the currently-cached info. this is called if a screen event occured
func (*WinGeomPrefsMgr) DeleteAll ¶
func (mgr *WinGeomPrefsMgr) 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 (*WinGeomPrefsMgr) Init ¶
func (mgr *WinGeomPrefsMgr) Init()
Init does initialization if not yet initialized
func (*WinGeomPrefsMgr) LockFile ¶
func (mgr *WinGeomPrefsMgr) LockFile() error
LockFile attempts to create the win_geom_prefs lock file
func (*WinGeomPrefsMgr) NeedToReload ¶
func (mgr *WinGeomPrefsMgr) NeedToReload() bool
NeedToReload returns true if the last save time of prefs file is more recent than when we last saved. Called under mutex.
func (*WinGeomPrefsMgr) Open ¶
func (mgr *WinGeomPrefsMgr) Open() error
Open RenderWin Geom preferences from GoGi standard prefs directory called under mutex or at start
func (*WinGeomPrefsMgr) Pref ¶
func (mgr *WinGeomPrefsMgr) Pref(winName string, scrn *goosi.Screen) *RenderWinGeom
Pref returns an existing preference for given window name, for given screen. if the window name has a colon, only the part prior to the colon is used. if no saved pref is available for that screen, nil is returned.
func (*WinGeomPrefsMgr) RecordPref ¶
func (mgr *WinGeomPrefsMgr) RecordPref(win *RenderWin)
RecordPref records current state of window as preference
func (*WinGeomPrefsMgr) ResetCache ¶
func (mgr *WinGeomPrefsMgr) ResetCache()
ResetCache resets the cache -- call under mutex
func (*WinGeomPrefsMgr) RestoreAll ¶
func (mgr *WinGeomPrefsMgr) RestoreAll()
RestoreAll restores size and position of all windows, for current screen. Called when screen changes.
func (*WinGeomPrefsMgr) Save ¶
func (mgr *WinGeomPrefsMgr) Save() error
Save RenderWin Geom Preferences to GoGi standard prefs directory assumed to be under mutex and lock still
func (*WinGeomPrefsMgr) SaveCached ¶
func (mgr *WinGeomPrefsMgr) SaveCached()
SaveCached saves the cached prefs -- called after timer delay, under the Mu.Lock
func (*WinGeomPrefsMgr) SaveLastSave ¶
func (mgr *WinGeomPrefsMgr) SaveLastSave()
SaveLastSave saves timestamp (now) of last save to win geom
func (*WinGeomPrefsMgr) SettingEnd ¶
func (mgr *WinGeomPrefsMgr) SettingEnd()
SettingEnd turns off SettingNoSave -- safe to call even if Start not called.
func (*WinGeomPrefsMgr) SettingStart ¶
func (mgr *WinGeomPrefsMgr) SettingStart()
SettingStart turns on SettingNoSave to prevent subsequent redundant calls to save a geometry that was being set from already-saved preferences. Must call SettingEnd to turn off (safe to call even if Start not called).
func (*WinGeomPrefsMgr) UnlockFile ¶
func (mgr *WinGeomPrefsMgr) UnlockFile()
UnLockFile unlocks the win_geom_prefs lock file (just removes it)
func (*WinGeomPrefsMgr) WinName ¶
func (mgr *WinGeomPrefsMgr) WinName(winName string) string
WinName returns window name before first colon, if exists. This is the part of the name used to record preferences
Source Files ¶
- app.go
- bars.go
- body.go
- box.go
- button.go
- chooser.go
- completer.go
- css.go
- dialogs.go
- doc.go
- enumgen.go
- eventmgr.go
- events.go
- flags.go
- frame.go
- gtigen.go
- handle.go
- icon.go
- image.go
- interfaces.go
- label.go
- labeledtextfield.go
- layimpl.go
- layout.go
- mainstage.go
- menu.go
- names.go
- popupstage.go
- progressbar.go
- render.go
- renderwin.go
- scene.go
- scroll.go
- separator.go
- settings.go
- slider.go
- snackbar.go
- spell.go
- spinner.go
- splits.go
- sprite.go
- stage.go
- stagemgr.go
- strings.go
- style.go
- svg.go
- switch.go
- switches.go
- tabs.go
- testing.go
- textfield.go
- themes.go
- toolbar.go
- tooltip.go
- trace.go
- transition.go
- version.go
- views.go
- widget.go
- wingeom.go
- winlists.go