Documentation ¶
Overview ¶
Package Gi (GoGi) provides a Graphical Interface based on GoKi Tree Node structs
2D and 3D (in gi3d) scenegraphs supported, each rendering to respective Viewport or Scene. Scene is a 2D element that embeds the 3D scene, and a 2D Viewport can in turn be embedded within the 3D scene.
The 2D scenegraph supports:
- Widget nodes for GUI actions (Buttons, Menus etc) -- render directly via Paint
- Layouts for placing widgets, which are also container nodes
- CSS-based styling, directly on Node Props (properties), and CSS StyleSheet
- svg sub-package with SVG Viewport and shapes, paths, etc -- full SVG support
- Icon is a wrapper around an SVG -- any SVG icon can be used
Layout Logic ¶
All 2D scenegraphs are controlled by the Layout, which provides the logic for organizing widgets / elements within the constraints of the display. Typically start with a vertical LayoutVert in the viewport, with LayoutHoriz's within that, or a LayoutGrid for more complex layouts:
win := gi.NewMainWindow("test-window", "Test Window", width, height) vp := win.WinViewport2D() updt := vp.UpdateStart() vlay := win.SetMainVLay() // or SetMainFrame row1 := gi.AddNewLayout(vlay, "row1", gi.LayoutHoriz) ... vp.UpdateEnd(updt)
Controlling the layout involves the following style properties:
width / height: sets the preferred size of item -- layout tries to give this amount of space unless it can't in which case it falls back on:
min-width / min-height: minimum size -- will not scale below this size. if not specified, it defaults to 1 em (the size of 1 character)
max-width / max-height: maximum size -- will not exceed this size if specified, otherwise if 0 it is ignored and preferred size is used. If a negative number is specified, then the item stretches to take up available room. The Stretch node is a builtin type that has this property set automatically, and can be added to any layout to fill up any available space. The preferred size of the item is used to determine how much of the space is used by each stretchable element, so you can set that to achieve different proportional spacing. By default the Stretch is just the minimum 1em in preferred size.
horizontal-align / vertical-align: for the other dimension in a Layout (e.g., for LayoutHoriz, the vertical dimension) this specifies how the items are aligned within the available space (e.g., tops, bottoms, centers). In the dimension of the Layout (horiz for LayoutHoriz) it determines how extra space is allocated (only if there aren't any infinitely stretchy elements), e.g., right / left / center or justified.
SetFixedWidth / Height method can be used to set all size params to the same value, causing that item to be definitively sized. This is convenient for sizing the Space node which adds a fixed amount of space (1em by default).
See the wiki for more detailed documentation.
Signals ¶
All widgets send appropriate signals about user actions -- Connect to those and check the signal type to determine the type of event. Only one connection per receiver -- handle all the different signal types in one function.
Views ¶
Views are Widgets that automatically display and interact with standard Go data, including structs, maps, slices, and the primitive data elements (string, int, etc). This implements a form of model / view separation between data and GUI representation thereof, where the models are the Go data elements themselves.
Views provide automatic, powerful GUI access to essentially any data in any other Go package. Furthermore, the ValueView framework allows for easy customization and extension of the GUI representation, based on the classic Go "Stringer"-like interface paradigm -- simply define a ValueView() method on any type, returning giv.ValueView that manages the interface between data structures and GUI representations.
See giv sub-package for all the View elements ¶
SVG for Icons, Displays, etc ¶
SVG (Structured Vector Graphics) is used icons, and for rendering any kind of graphical output (drawing a graph, dial, etc). See svg sub-package, and examples/svg for an svg viewer, and examples/marbles for an svg animation.
Overlays and Sprites ¶
The gi.Window can render Sprite images to an OverTex overlay texture, which is cleared to be transparent prior to rendering any active sprites. This is used for cursors (e.g., TextField, giv.TextView cursors), Drag-n-Drop, etc.
Index ¶
- Constants
- Variables
- func AddToSpellModel(filepath string) error
- func AggCSS(agg *ki.Props, css ki.Props)
- func AppName() string
- func ChoiceDialog(avp *Viewport2D, opts DlgOpts, choices []string, recv ki.Ki, fun ki.RecvFunc)
- func CompleteEditText(text string, cp int, completion string, seed string) (ed complete.Edit)
- func CompleteText(s string) []string
- func CopyGradient(dst, src *rasterx.Gradient)
- func DNDModCursor(dmod dnd.DropMods) cursor.Shapes
- func DefaultColorSchemes() map[string]*ColorPrefs
- func EndCPUMemProfile()
- func EndTargProfile()
- func FindEllipseCenter(rx, ry *float32, rotX, startX, startY, endX, endY float32, ...) (cx, cy float32)
- func FixFontMods(fn string) string
- func FixGradientStops(grad *rasterx.Gradient)
- func FontAlts(fams string) (fns []string, serif, mono bool)
- func FontFaceName(fam string, str FontStretch, wt FontWeights, sty FontStyles) string
- func FontNameFromMods(basenm string, str FontStretch, wt FontWeights, sty FontStyles) string
- func FontNameToMods(fn string) (basenm string, str FontStretch, wt FontWeights, sty FontStyles)
- func FontSerifMonoGuess(fns []string) (serif, mono bool)
- func GrabRenderFrom(nii Node2D) *image.RGBA
- func HSLtoRGBf32(h, s, l float32) (r, g, b float32)
- func ImageClearer(im *image.RGBA, pct float32)
- func Init()
- func InitSpell() error
- func IsAlignEnd(a Align) bool
- func IsAlignMiddle(a Align) bool
- func IsAlignStart(a Align) bool
- func KiToNode2D(k ki.Ki) (Node2D, *Node2DBase)
- func MainMenuFunc(owin oswin.Window, title string, tag int)
- func MatToRasterx(mat *mat32.Mat2) rasterx.Matrix2D
- func NewKiDialogValues(dlg *Dialog) (int, reflect.Type)
- func NewSpellModelFromText() error
- func NextRuneAt(str string, idx int) rune
- func OpenImage(path string) (image.Image, error)
- func OpenPNG(path string) (image.Image, error)
- func OpenPaths()
- func OpenSpellModel() error
- func OpenURL(url string)
- func ParseDashesString(str string) []float64
- func PollEvents()
- func PopupIsCompleter(pop ki.Ki) bool
- func PopupIsCorrector(pop ki.Ki) bool
- func PopupIsMenu(pop ki.Ki) bool
- func PopupIsTooltip(pop ki.Ki) bool
- func ProfileToggle()
- func PromptDialog(avp *Viewport2D, opts DlgOpts, ok, cancel bool, recv ki.Ki, fun ki.RecvFunc)
- func Quit()
- func RGBtoHSLf32(r, g, b float32) (h, s, l float32)
- func SaveImage(path string, im image.Image) error
- func SavePNG(path string, im image.Image) error
- func SavePaths()
- func SaveSpellModel() error
- func SetActiveKeyMap(km *KeyMap, kmName KeyMapName)
- func SetActiveKeyMapName(mapnm KeyMapName)
- func SetAppAbout(about string)
- func SetAppName(name string)
- func SetGradientBounds(grad *rasterx.Gradient, bounds image.Rectangle)
- func SetHTMLSimpleTag(tag string, fs *FontStyle, ctxt *units.Context, cssAgg ki.Props) bool
- func SetQuitCleanFunc(fun func())
- func SetQuitReqFunc(fun func())
- func SetStylePropsXML(style string, props *ki.Props)
- func ShortcutForFun(kf KeyFuns) key.Chord
- func SignalViewport2D(vpki, send ki.Ki, sig int64, data interface{})
- func SignalWindowPublish(winki, node ki.Ki, sig int64, data interface{})
- func StartCPUMemProfile()
- func StartTargProfile()
- func StringPromptDialogValue(dlg *Dialog) string
- func StringsAddExtras(items *[]string, extras []string)
- func StringsAppendIfUnique(strs *[]string, str string, max int)
- func StringsDelete(strs *[]string, str string)
- func StringsInsertFirst(strs *[]string, str string, max int)
- func StringsInsertFirstUnique(strs *[]string, str string, max int)
- func StringsRemoveExtras(items *[]string, extras []string)
- func StyleInhInit(val, par interface{}) (inh, init bool)
- func StyleSetError(key string, val interface{})
- func SubProps(prp ki.Props, selector string) (ki.Props, bool)
- func TextFieldBlink()
- func ToLabel(it interface{}) string
- func ToLabeler(it interface{}) (string, bool)
- func WinNewCloseStamp()
- func XMLAttr(name string, attrs []xml.Attr) string
- type ActOpts
- type Action
- func (ac *Action) ButtonRelease()
- func (ac *Action) ConfigParts()
- func (ac *Action) ConfigPartsAddShortcut(config *kit.TypeAndNameList) int
- func (ac *Action) ConfigPartsButton()
- func (ac *Action) ConfigPartsMenuItem()
- func (ac *Action) ConfigPartsShortcut(scIdx int)
- func (ac *Action) CopyFieldsFrom(frm interface{})
- func (ac *Action) Disconnect()
- func (ac *Action) Init2D()
- func (ac *Action) Trigger()
- func (ac *Action) UpdateActions()
- type Align
- type BaselineShifts
- type Bitmap
- func (bm *Bitmap) CopyFieldsFrom(frm interface{})
- func (bm *Bitmap) DrawIntoViewport(parVp *Viewport2D)
- func (bm *Bitmap) GrabRenderFrom(nii Node2D)
- func (bm *Bitmap) LayoutToImgSize()
- func (bm *Bitmap) OpenImage(filename FileName, width, height float32) error
- func (bm *Bitmap) Render2D()
- func (bm *Bitmap) Resize(nwsz image.Point)
- func (bm *Bitmap) SetImage(img image.Image, width, height float32)
- type BorderDrawStyle
- type BorderStyle
- type BoxSides
- type Button
- type ButtonBase
- func (bb *ButtonBase) AsButtonBase() *ButtonBase
- func (bb *ButtonBase) BaseButtonRelease()
- func (bb *ButtonBase) ButtonEnterHover()
- func (bb *ButtonBase) ButtonEvents()
- func (bb *ButtonBase) ButtonExitHover()
- func (bb *ButtonBase) ButtonPress()
- func (bb *ButtonBase) ButtonRelease()
- func (bb *ButtonBase) ConfigParts()
- func (bb *ButtonBase) ConfigPartsAddIndicator(config *kit.TypeAndNameList, defOn bool) int
- func (bb *ButtonBase) ConfigPartsAddIndicatorSpace(config *kit.TypeAndNameList, defOn bool) int
- func (bb *ButtonBase) ConfigPartsIfNeeded()
- func (bb *ButtonBase) ConfigPartsIndicator(indIdx int)
- func (bb *ButtonBase) ConnectEvents2D()
- func (bb *ButtonBase) CopyFieldsFrom(frm interface{})
- func (bb *ButtonBase) Destroy()
- func (bb *ButtonBase) Disconnect()
- func (bb *ButtonBase) FocusChanged2D(change FocusChanges)
- func (bb *ButtonBase) HasMenu() bool
- func (bb *ButtonBase) HoverTooltipEvent()
- func (bb *ButtonBase) Init2D()
- func (bb *ButtonBase) IsCheckable() bool
- func (bb *ButtonBase) IsChecked() bool
- func (bb *ButtonBase) IsMenu() bool
- func (bb *ButtonBase) KeyChordEvent()
- func (bb *ButtonBase) Layout2D(parBBox image.Rectangle, iter int) bool
- func (bb *ButtonBase) MouseEvent()
- func (bb *ButtonBase) MouseFocusEvent()
- func (bb *ButtonBase) OpenMenu() bool
- func (bb *ButtonBase) Render2D()
- func (bb *ButtonBase) ResetMenu()
- func (bb *ButtonBase) SetAsButton()
- func (bb *ButtonBase) SetAsMenu()
- func (bb *ButtonBase) SetButtonState(state ButtonStates) bool
- func (bb *ButtonBase) SetCheckable(checkable bool)
- func (bb *ButtonBase) SetChecked(chk bool)
- func (bb *ButtonBase) SetIcon(iconName string)
- func (bb *ButtonBase) SetText(txt string)
- func (bb *ButtonBase) Style2D()
- func (bb *ButtonBase) StyleButton()
- func (bb *ButtonBase) StyleParts()
- func (bb *ButtonBase) ToggleChecked()
- func (bb *ButtonBase) UpdateButtonStyle() bool
- type ButtonBox
- func (bb *ButtonBox) BitFlagsValue(enumtyp reflect.Type) int64
- func (bb *ButtonBox) ConfigItems()
- func (bb *ButtonBox) ConfigParts()
- func (bb *ButtonBox) ConfigPartsIfNeeded()
- func (bb *ButtonBox) CopyFieldsFrom(frm interface{})
- func (bb *ButtonBox) Disconnect()
- func (bb *ButtonBox) Init2D()
- func (bb *ButtonBox) ItemsFromEnum(enumtyp reflect.Type)
- func (bb *ButtonBox) ItemsFromEnumList(el []kit.EnumValue)
- func (bb *ButtonBox) ItemsFromStringList(el []string)
- func (bb *ButtonBox) Layout2D(parBBox image.Rectangle, iter int) bool
- func (bb *ButtonBox) Render2D()
- func (bb *ButtonBox) SelectItem(idx int) error
- func (bb *ButtonBox) Style2D()
- func (bb *ButtonBox) UnCheckAll()
- func (bb *ButtonBox) UpdateFromBitFlags(enumtyp reflect.Type, val int64)
- type ButtonFlags
- type ButtonSignals
- type ButtonStates
- type ButtonWidget
- type CheckBox
- func (cb *CheckBox) AsButtonBase() *ButtonBase
- func (cb *CheckBox) ButtonRelease()
- func (cb *CheckBox) ConfigParts()
- func (cb *CheckBox) ConfigPartsIfNeeded()
- func (cb *CheckBox) CopyFieldsFrom(frm interface{})
- func (cb *CheckBox) Init2D()
- func (cb *CheckBox) SetIconProps(props ki.Props)
- func (cb *CheckBox) SetIcons(icOn, icOff string)
- func (cb *CheckBox) StyleParts()
- type Clipper
- type Color
- func (c *Color) Add(dc Color)
- func (c *Color) Blend(pct float32, clr color.Color) Color
- func (c *Color) Clearer(pct float32) Color
- func (c *Color) Darker(pct float32) Color
- func (c *Color) HexString() string
- func (c *Color) Highlight(pct float32) Color
- func (c *Color) IsBlack() bool
- func (c *Color) IsDark() bool
- func (c *Color) IsNil() bool
- func (c *Color) IsWhite() bool
- func (c *Color) Lighter(pct float32) Color
- func (c *Color) Opaquer(pct float32) Color
- func (c *Color) ParseHex(x string) error
- func (c *Color) Pastel(pct float32) Color
- func (c Color) RGBA() (r, g, b, a uint32)
- func (c *Color) Samelight(pct float32) Color
- func (c *Color) Saturate(pct float32) Color
- func (c *Color) SetAlphaPreFix() bool
- func (c *Color) SetAlphaPreMult() bool
- func (c *Color) SetColor(ci color.Color)
- func (c *Color) SetFloat32(r, g, b, a float32)
- func (c *Color) SetFloat64(r, g, b, a float64)
- func (c *Color) SetHSL(h, s, l float32)
- func (c *Color) SetHSLA(h, s, l, a float32)
- func (c *Color) SetIFace(val interface{}, vp *Viewport2D, key string) error
- func (c *Color) SetInt(r, g, b, a int)
- func (c *Color) SetNPFloat32(r, g, b, a float32)
- func (c *Color) SetName(name string) error
- func (c *Color) SetNotAlphaPreMult() bool
- func (c *Color) SetString(str string, base color.Color) error
- func (c *Color) SetStringStyle(str string, base color.Color, vp *Viewport2D) error
- func (c *Color) SetToNil()
- func (c *Color) SetUInt32(r, g, b, a uint32)
- func (c *Color) SetUInt8(r, g, b, a uint8)
- func (c *Color) String() string
- func (c *Color) Sub(dc Color)
- func (c *Color) ToFloat32() (r, g, b, a float32)
- func (c *Color) ToHSLA() (h, s, l, a float32)
- func (c *Color) ToNPFloat32() (r, g, b, a float32)
- type ColorName
- type ColorPrefs
- type ColorSources
- type ColorSpec
- func (cs *ColorSpec) ColorOrNil() color.Color
- func (cs *ColorSpec) CopyFrom(cp *ColorSpec)
- func (cs *ColorSpec) IsNil() bool
- func (cs *ColorSpec) ReadGradAttr(attr xml.Attr) (err error)
- func (cs *ColorSpec) ReadXML(reader io.Reader) error
- func (cs *ColorSpec) RenderColor(opacity float32, bounds image.Rectangle, xform mat32.Mat2) interface{}
- func (cs *ColorSpec) SetColor(cl color.Color)
- func (c *ColorSpec) SetIFace(val interface{}, vp *Viewport2D, key string) error
- func (cs *ColorSpec) SetName(name string)
- func (cs *ColorSpec) SetShadowGradient(cl color.Color, dir string)
- func (cs *ColorSpec) SetString(clrstr string, vp *Viewport2D) bool
- func (cs *ColorSpec) UnmarshalXML(decoder *xml.Decoder, se xml.StartElement) error
- type ComboBox
- func (cb *ComboBox) ButtonRelease()
- func (cb *ComboBox) ConfigParts()
- func (cb *ComboBox) ConfigPartsIconText(config *kit.TypeAndNameList, icnm string) (icIdx, txIdx int)
- func (cb *ComboBox) ConfigPartsIfNeeded()
- func (cb *ComboBox) ConfigPartsSetText(txt string, txIdx, icIdx, indIdx int)
- func (cb *ComboBox) CopyFieldsFrom(frm interface{})
- func (cb *ComboBox) Disconnect()
- func (cb *ComboBox) FindItem(it interface{}) int
- func (cb *ComboBox) ItemsFromEnum(enumtyp reflect.Type, setFirst bool, maxLen int)
- func (cb *ComboBox) ItemsFromEnumList(el []kit.EnumValue, setFirst bool, maxLen int)
- func (cb *ComboBox) ItemsFromStringList(el []string, setFirst bool, maxLen int)
- func (cb *ComboBox) ItemsFromTypes(tl []reflect.Type, setFirst, sort bool, maxLen int)
- func (cb *ComboBox) MakeItems(reset bool, capacity int)
- func (cb *ComboBox) MakeItemsMenu()
- func (cb *ComboBox) SelectItem(idx int)
- func (cb *ComboBox) SetCurIndex(idx int) interface{}
- func (cb *ComboBox) SetCurVal(it interface{}) int
- func (cb *ComboBox) SetToMaxLength(maxLen int)
- func (cb *ComboBox) SortItems(ascending bool)
- func (cb *ComboBox) TextField() (*TextField, bool)
- type Complete
- func (c *Complete) Abort() bool
- func (c *Complete) Cancel() bool
- func (c *Complete) Complete(s string)
- func (cm *Complete) Disconnect()
- func (c *Complete) GetCompletion(s string) complete.Completion
- func (c *Complete) IsAboutToShow() bool
- func (c *Complete) KeyInput(kf KeyFuns) bool
- func (c *Complete) Lookup(text string, posLn, posCh int, vp *Viewport2D, pt image.Point, force bool)
- func (c *Complete) Show(text string, posLn, posCh int, vp *Viewport2D, pt image.Point, force bool)
- func (c *Complete) ShowNow(text string, posLn, posCh int, vp *Viewport2D, pt image.Point, force bool)
- type CompleteSignals
- type Completer
- type CtxtMenuFunc
- type DNDStages
- type Dialog
- func NewKiDialog(avp *Viewport2D, iface reflect.Type, opts DlgOpts, recv ki.Ki, fun ki.RecvFunc) *Dialog
- func NewStdDialog(opts DlgOpts, ok, cancel bool) *Dialog
- func RecycleStdDialog(data interface{}, opts DlgOpts, ok, cancel bool) (*Dialog, bool)
- func StringPromptDialog(avp *Viewport2D, strval, placeholder string, opts DlgOpts, recv ki.Ki, ...) *Dialog
- func (dlg *Dialog) Accept()
- func (dlg *Dialog) AddButtonBox(frame *Frame) *Layout
- func (dlg *Dialog) ButtonBox(frame *Frame) (*Layout, int)
- func (dlg *Dialog) Cancel()
- func (dlg *Dialog) Close()
- func (dlg *Dialog) Disconnect()
- func (dlg *Dialog) Frame() *Frame
- func (dlg *Dialog) HasFocus2D() bool
- func (dlg *Dialog) Init2D()
- func (dlg *Dialog) Open(x, y int, avp *Viewport2D, cfgFunc func()) bool
- func (dlg *Dialog) PromptWidget(frame *Frame) (*Label, int)
- func (dlg *Dialog) SetFrame() *Frame
- func (dlg *Dialog) SetPrompt(prompt string, frame *Frame) *Label
- func (dlg *Dialog) SetTitle(title string, frame *Frame) *Label
- func (dlg *Dialog) StdButtonConfig(stretch, ok, cancel bool) kit.TypeAndNameList
- func (dlg *Dialog) StdButtonConnect(ok, cancel bool, bb *Layout)
- func (dlg *Dialog) StdDialog(title, prompt string, ok, cancel bool)
- func (dlg *Dialog) TitleWidget(frame *Frame) (*Label, int)
- type DialogState
- type DlgOpts
- type DragNDropper
- type EditorPrefs
- type EventMaster
- type EventMgr
- func (em *EventMgr) ActivateStartFocus() bool
- func (em *EventMgr) ClearDND()
- func (em *EventMgr) ClearNonFocus(foc ki.Ki)
- func (em *EventMgr) ConnectEvent(recv ki.Ki, et oswin.EventType, pri EventPris, fun ki.RecvFunc)
- func (em *EventMgr) CurFocus() ki.Ki
- func (em *EventMgr) DNDIsInternalSrc() bool
- func (em *EventMgr) DNDStart(src ki.Ki, data mimedata.Mimes)
- func (em *EventMgr) DNDStartEvent(e *mouse.DragEvent)
- func (em *EventMgr) DisconnectAllEvents(recv ki.Ki, pri EventPris)
- func (em *EventMgr) DisconnectEvent(recv ki.Ki, et oswin.EventType, pri EventPris)
- func (em *EventMgr) DoInstaDrag(me *mouse.DragEvent, popup bool) bool
- func (em *EventMgr) FilterLaggyEvents(evi oswin.Event) bool
- func (em *EventMgr) FocusLast() bool
- func (em *EventMgr) FocusNext(foc ki.Ki) bool
- func (em *EventMgr) FocusOnOrNext(foc ki.Ki) bool
- func (em *EventMgr) FocusOnOrPrev(foc ki.Ki) bool
- func (em *EventMgr) FocusPrev(foc ki.Ki) bool
- func (em *EventMgr) GenDNDFocusEvents(mev *dnd.MoveEvent, popup bool) bool
- func (em *EventMgr) GenMouseFocusEvents(mev *mouse.MoveEvent, popup bool) bool
- func (em *EventMgr) InitialFocus()
- func (em *EventMgr) ManagerKeyChordEvents(e *key.ChordEvent)
- func (em *EventMgr) MouseDragEvents(evi oswin.Event)
- func (em *EventMgr) MouseEventReset(evi oswin.Event)
- func (em *EventMgr) MouseEvents(evi oswin.Event)
- func (em *EventMgr) MouseMoveEvents(evi oswin.Event)
- func (em *EventMgr) PopFocus()
- func (em *EventMgr) PushFocus(p ki.Ki)
- func (em *EventMgr) ResetMouseDrag()
- func (em *EventMgr) ResetMouseMove()
- func (em *EventMgr) SendDNDDropEvent(e *mouse.Event) bool
- func (em *EventMgr) SendDNDHoverEvent(e *mouse.DragEvent)
- func (em *EventMgr) SendDNDMoveEvent(e *mouse.DragEvent) *dnd.MoveEvent
- func (em *EventMgr) SendEventSignal(evi oswin.Event, popup bool)
- func (em *EventMgr) SendEventSignalFunc(evi oswin.Event, popup bool, rvs *WinEventRecvList, recv ki.Ki, ...) bool
- func (em *EventMgr) SendHoverEvent(e *mouse.MoveEvent)
- func (em *EventMgr) SendKeyChordEvent(popup bool, r rune, mods ...key.Modifiers)
- func (em *EventMgr) SendKeyFunEvent(kf KeyFuns, popup bool)
- func (em *EventMgr) SendSig(recv, sender ki.Ki, evi oswin.Event)
- func (em *EventMgr) SetFocus(k ki.Ki) bool
- func (em *EventMgr) SetStartFocus(k ki.Ki)
- type EventPris
- type FavPathItem
- type FavPaths
- type FileName
- type FilePaths
- type FillRules
- type FillStyle
- type FocusChanges
- type FontFace
- type FontInfo
- type FontLib
- func (fl *FontLib) AddFontPaths(paths ...string) bool
- func (fl *FontLib) DeleteFont(fontnm string)
- func (fl *FontLib) Font(fontnm string, size int) (*FontFace, error)
- func (fl *FontLib) FontAvail(fontnm string) bool
- func (fl *FontLib) FontsAvailFromPath(path string) error
- func (fl *FontLib) GoFontsAvail()
- func (fl *FontLib) Init()
- func (fl *FontLib) InitFontPaths(paths ...string)
- func (fl *FontLib) OpenAllFonts(size int)
- func (fl *FontLib) UpdateFontsAvail() bool
- type FontMetrics
- type FontName
- type FontStretch
- type FontStyle
- func (fs *FontStyle) ClearDeco(deco TextDecorations)
- func (fs *FontStyle) CopyNonDefaultProps(node ki.Ki)
- func (fs *FontStyle) Defaults()
- func (fs *FontStyle) FaceName() string
- func (fs *FontStyle) InheritFields(par *FontStyle)
- func (fs *FontStyle) OpenFont(ctxt *units.Context)
- func (fs *FontStyle) SetDeco(deco TextDecorations)
- func (fs *FontStyle) SetStylePost(props ki.Props)
- func (fs *FontStyle) SetStyleProps(parent *FontStyle, props ki.Props, vp *Viewport2D)
- func (fs *FontStyle) SetUnitContext(ctxt *units.Context)
- func (fs *FontStyle) StyleCSS(tag string, cssAgg ki.Props, ctxt *units.Context, vp *Viewport2D) bool
- func (fs *FontStyle) StyleFromProps(par *FontStyle, props ki.Props, vp *Viewport2D)
- func (fs *FontStyle) ToDots(uc *units.Context)
- type FontStyles
- type FontVariants
- type FontWeights
- type Frame
- type Geom2DInt
- type GoFontInfo
- type Gradient
- type GradientPoints
- type GridData
- type HSLA
- type HiStyleName
- type Icon
- type IconMgr
- type IconName
- type KeyFuns
- type KeyMap
- type KeyMapItem
- type KeyMapName
- type KeyMaps
- func (km *KeyMaps) CopyFrom(cp KeyMaps)
- func (km *KeyMaps) MapByName(name KeyMapName) (*KeyMap, int, bool)
- func (km *KeyMaps) OpenJSON(filename FileName) error
- func (km *KeyMaps) OpenPrefs() error
- func (km *KeyMaps) RevertToStd()
- func (km *KeyMaps) SaveJSON(filename FileName) error
- func (km *KeyMaps) SavePrefs() error
- func (km *KeyMaps) ViewStd()
- type KeyMapsItem
- type Label
- func (lb *Label) ConnectEvents2D()
- func (lb *Label) CopyFieldsFrom(frm interface{})
- func (lb *Label) Disconnect()
- func (lb *Label) GrabCurBgColor()
- func (lb *Label) HoverEvent()
- func (lb *Label) LabelEvents()
- func (lb *Label) Layout2D(parBBox image.Rectangle, iter int) bool
- func (lb *Label) LayoutLabel()
- func (lb *Label) MouseEvent()
- func (lb *Label) MouseMoveEvent()
- func (lb *Label) OpenLink(tl *TextLink)
- func (lb *Label) Render2D()
- func (lb *Label) SetStateStyle()
- func (lb *Label) SetText(txt string)
- func (lb *Label) Size2D(iter int)
- func (lb *Label) Style2D()
- func (lb *Label) StyleLabel()
- func (lb *Label) TextPos() mat32.Vec2
- type LabelStates
- type Labeler
- type Layout
- func (ly *Layout) AllocFromParent()
- func (ly *Layout) AsLayout2D() *Layout
- func (ly *Layout) AutoScroll(pos image.Point) bool
- func (ly *Layout) AutoScrollDim(dim mat32.Dims, st, pos int) bool
- func (ly *Layout) AvailSize() mat32.Vec2
- func (ly *Layout) BBox2D() image.Rectangle
- func (ly *Layout) ChildByLabelStartsCanFocus(name string, after ki.Ki) (ki.Ki, bool)
- func (ly *Layout) ChildWithFocus() (ki.Ki, int)
- func (ly *Layout) ChildrenBBox2D() image.Rectangle
- func (ly *Layout) ChildrenUpdateSizes()
- func (ly *Layout) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)
- func (ly *Layout) ConnectEvents2D()
- func (ly *Layout) CopyFieldsFrom(frm interface{})
- func (ly *Layout) DeactivateScroll(sc *ScrollBar)
- func (ly *Layout) DeleteScroll(d mat32.Dims)
- func (ly *Layout) FinalizeLayout()
- func (ly *Layout) FocusNextChild(updn bool) bool
- func (ly *Layout) FocusOnName(kt *key.ChordEvent) bool
- func (ly *Layout) FocusPrevChild(updn bool) bool
- func (ly *Layout) GatherSizes()
- func (ly *Layout) GatherSizesFlow(iter int)
- func (ly *Layout) GatherSizesGrid()
- func (ly *Layout) GatherSizesSumMax() (sumPref, sumNeed, maxPref, maxNeed mat32.Vec2)
- func (ly *Layout) HasAnyScroll() bool
- func (ly *Layout) HasFocus2D() bool
- func (ly *Layout) Init2D()
- func (ly *Layout) KeyChordEvent()
- func (ly *Layout) Layout2D(parBBox image.Rectangle, iter int) bool
- func (ly *Layout) LayoutAlongDim(dim mat32.Dims)
- func (ly *Layout) LayoutFlow(dim mat32.Dims, iter int) bool
- func (ly *Layout) LayoutGrid()
- func (ly *Layout) LayoutGridDim(rowcol RowCol, dim mat32.Dims)
- func (ly *Layout) LayoutKeys(kt *key.ChordEvent)
- func (ly *Layout) LayoutScrollEvents()
- func (ly *Layout) LayoutScrolls()
- func (ly *Layout) LayoutSharedDim(dim mat32.Dims)
- func (ly *Layout) LayoutSharedDimImpl(avail, need, pref, max, spc float32, al Align) (pos, size float32)
- func (ly *Layout) ManageOverflow()
- func (ly *Layout) Move2D(delta image.Point, parBBox image.Rectangle)
- func (ly *Layout) Move2DChildren(delta image.Point)
- func (ly *Layout) Move2DDelta(delta image.Point) image.Point
- func (ly *Layout) Move2DScrolls(delta image.Point, parBBox image.Rectangle)
- func (ly *Layout) ReRenderScrolls()
- func (ly *Layout) Render2D()
- func (ly *Layout) Render2DChildren()
- func (ly *Layout) RenderScrolls()
- func (ly *Layout) ScrollActionDelta(dim mat32.Dims, delta float32)
- func (ly *Layout) ScrollActionPos(dim mat32.Dims, pos float32)
- func (ly *Layout) ScrollDelta(me *mouse.ScrollEvent)
- func (ly *Layout) ScrollDimToCenter(dim mat32.Dims, pos int) bool
- func (ly *Layout) ScrollDimToEnd(dim mat32.Dims, pos int) bool
- func (ly *Layout) ScrollDimToStart(dim mat32.Dims, pos int) bool
- func (ly *Layout) ScrollToBox(box image.Rectangle) bool
- func (ly *Layout) ScrollToBoxDim(dim mat32.Dims, minBox, maxBox int) bool
- func (ly *Layout) ScrollToItem(ni Node2D) bool
- func (ly *Layout) ScrollToPos(dim mat32.Dims, pos float32)
- func (ly *Layout) SetScroll(d mat32.Dims)
- func (ly *Layout) SetScrollsOff()
- func (ly *Layout) Size2D(iter int)
- func (ly *Layout) Style2D()
- func (ly *Layout) StyleFromProps(props ki.Props, vp *Viewport2D)
- func (ly *Layout) StyleLayout()
- func (ly *Layout) StyleToDots(uc *units.Context)
- func (ly *Layout) SumDim(d mat32.Dims) bool
- func (ly *Layout) SummedDim() mat32.Dims
- type LayoutAllocs
- type LayoutState
- type LayoutStyle
- func (ls *LayoutStyle) AlignDim(d mat32.Dims) Align
- func (ls *LayoutStyle) Defaults()
- func (ls *LayoutStyle) MaxSizeDots() mat32.Vec2
- func (ls *LayoutStyle) MinSizeDots() mat32.Vec2
- func (ls *LayoutStyle) PosDots() mat32.Vec2
- func (ls *LayoutStyle) SetStylePost(props ki.Props)
- func (ls *LayoutStyle) SizeDots() mat32.Vec2
- func (ly *LayoutStyle) ToDots(uc *units.Context)
- type Layouts
- type LineCaps
- type LineJoins
- type MakeMenuFunc
- type Menu
- func (m *Menu) AddAction(opts ActOpts, sigTo ki.Ki, fun ki.RecvFunc) *Action
- func (m *Menu) AddAppMenu(win *Window)
- func (m *Menu) AddCopyCutPaste(win *Window)
- func (m *Menu) AddCopyCutPasteDupe(win *Window)
- func (m *Menu) AddLabel(lbl string) *Label
- func (m *Menu) AddSeparator(name string) *Separator
- func (m *Menu) AddStdAppMenu(win *Window)
- func (m *Menu) AddWindowsMenu(win *Window)
- func (m *Menu) CopyFrom(men *Menu)
- func (m *Menu) DeleteShortcuts(win *Window)
- func (m *Menu) FindActionByName(name string) (*Action, bool)
- func (m *Menu) InsertActionAfter(after string, opts ActOpts, sigTo ki.Ki, fun ki.RecvFunc) *Action
- func (m *Menu) InsertActionBefore(before string, opts ActOpts, sigTo ki.Ki, fun ki.RecvFunc) *Action
- func (m Menu) MarshalJSON() ([]byte, error)
- func (m *Menu) SetAction(ac *Action, opts ActOpts, sigTo ki.Ki, fun ki.RecvFunc)
- func (m *Menu) SetShortcuts(win *Window)
- func (m *Menu) UnmarshalJSON(b []byte) error
- func (m *Menu) UpdateActions()
- type MenuBar
- func (mb *MenuBar) ConfigMenus(menus []string)
- func (mb *MenuBar) CopyFieldsFrom(frm interface{})
- func (mb *MenuBar) DeleteShortcuts()
- func (mb *MenuBar) Destroy()
- func (m *MenuBar) FindActionByName(name string) (*Action, bool)
- func (mb *MenuBar) Layout2D(parBBox image.Rectangle, iter int) bool
- func (mb *MenuBar) MainMenuUpdateActives(win *Window)
- func (mb *MenuBar) MenuBarStdRender()
- func (mb *MenuBar) Render2D()
- func (mb *MenuBar) SetMainMenu(win *Window)
- func (mb *MenuBar) SetMainMenuSub(osmm oswin.MainMenu, subm oswin.Menu, am *Action)
- func (mb *MenuBar) SetShortcuts()
- func (mb *MenuBar) ShowMenuBar() bool
- func (mb *MenuBar) Size2D(iter int)
- func (mb *MenuBar) UpdateActions()
- func (mb *MenuBar) UpdateMainMenu(win *Window)
- type MenuButton
- type MetaData2D
- type NRGBAf32
- type Node
- type Node2D
- type Node2DBase
- func (nb *Node2DBase) AsLayout2D() *Layout
- func (nb *Node2DBase) AsNode2D() *Node2DBase
- func (nb *Node2DBase) AsViewport2D() *Viewport2D
- func (nb *Node2DBase) AsWidget() *WidgetBase
- func (nb *Node2DBase) BBox2D() image.Rectangle
- func (nb *Node2DBase) BBoxReport() string
- func (n *Node2DBase) BaseIface() reflect.Type
- func (nb *Node2DBase) ChildrenBBox2D() image.Rectangle
- func (nb *Node2DBase) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)
- func (nb *Node2DBase) ComputeBBox2DBase(parBBox image.Rectangle, delta image.Point)
- func (nb *Node2DBase) ConnectEvent(et oswin.EventType, pri EventPris, fun ki.RecvFunc)
- func (nb *Node2DBase) ConnectEvents2D()
- func (nb *Node2DBase) ConnectToViewport()
- func (nb *Node2DBase) ContainsFocus() bool
- func (nb *Node2DBase) ContextMenu()
- func (nb *Node2DBase) ContextMenuPos() (pos image.Point)
- func (nb *Node2DBase) CopyFieldsFrom(frm interface{})
- func (nb *Node2DBase) DirectWinUpload() bool
- func (nb *Node2DBase) DisconnectAllEvents(pri EventPris)
- func (nb *Node2DBase) DisconnectEvent(et oswin.EventType, pri EventPris)
- func (nb *Node2DBase) DisconnectViewport()
- func (nb *Node2DBase) EventMgr2D() *EventMgr
- func (nb *Node2DBase) FindNamedElement(name string) Node2D
- func (nb *Node2DBase) FocusChanged2D(change FocusChanges)
- func (nb *Node2DBase) FocusNext()
- func (nb *Node2DBase) FocusPrev()
- func (nb *Node2DBase) FullInit2DTree()
- func (nb *Node2DBase) FullRender2DTree()
- func (nb *Node2DBase) GrabFocus()
- func (nb *Node2DBase) HasFocus2D() bool
- func (nb *Node2DBase) Init2D()
- func (nb *Node2DBase) Init2DTree()
- func (nb *Node2DBase) IsDirectWinUpload() bool
- func (nb *Node2DBase) IsVisible() bool
- func (nb *Node2DBase) Layout2D(parBBox image.Rectangle, iter int) bool
- func (nb *Node2DBase) Layout2DChildren(iter int) bool
- func (nb *Node2DBase) Layout2DTree()
- func (nb *Node2DBase) MakeContextMenu(m *Menu)
- func (nb *Node2DBase) Move2D(delta image.Point, parBBox image.Rectangle)
- func (nb *Node2DBase) Move2DChildren(delta image.Point)
- func (nb *Node2DBase) NeedsFullReRender2DTree() bool
- func (nb *Node2DBase) ParentLayout() *Layout
- func (nb *Node2DBase) ParentPaint() *Paint
- func (nb *Node2DBase) ParentReRenderAnchor() Node2D
- func (nb *Node2DBase) ParentScrollLayout() *Layout
- func (nb *Node2DBase) ParentStyle() *Style
- func (nb *Node2DBase) ParentViewport() *Viewport2D
- func (nb *Node2DBase) ParentWindow() *Window
- func (nb *Node2DBase) PropTag() string
- func (nb *Node2DBase) Render2D()
- func (nb *Node2DBase) Render2DChildren()
- func (nb *Node2DBase) Render2DTree()
- func (nb *Node2DBase) ScrollToMe() bool
- func (nb *Node2DBase) SetFixedHeight(val units.Value)
- func (nb *Node2DBase) SetFixedWidth(val units.Value)
- func (nb *Node2DBase) SetMinPrefHeight(val units.Value)
- func (nb *Node2DBase) SetMinPrefWidth(val units.Value)
- func (nb *Node2DBase) SetStretchMax()
- func (nb *Node2DBase) SetStretchMaxHeight()
- func (nb *Node2DBase) SetStretchMaxWidth()
- func (nb *Node2DBase) SetWinBBox()
- func (nb *Node2DBase) Size2D(iter int)
- func (nb *Node2DBase) Size2DTree(iter int)
- func (nb *Node2DBase) StartFocus()
- func (nb *Node2DBase) Style2D()
- func (nb *Node2DBase) Style2DTree()
- func (nb *Node2DBase) TopNode2D() Node
- func (nb *Node2DBase) TopUpdateEnd(updt bool)
- func (nb *Node2DBase) TopUpdateStart() bool
- func (nb *Node2DBase) WinFullReRender()
- type NodeBase
- func (nb *NodeBase) AddClass(cls string)
- func (nb *NodeBase) AsGiNode() *NodeBase
- func (nb *NodeBase) CanFocus() bool
- func (nb *NodeBase) ClearFullReRender()
- func (nb *NodeBase) ClearInactive()
- func (nb *NodeBase) ClearInvisible()
- func (nb *NodeBase) ClearSelected()
- func (nb *NodeBase) CopyFieldsFrom(frm interface{})
- func (nb *NodeBase) FirstContainingPoint(pt image.Point, leavesOnly bool) ki.Ki
- func (nb *NodeBase) HasFocus() bool
- func (nb *NodeBase) HasNoLayout() bool
- func (nb *NodeBase) IsActive() bool
- func (nb *NodeBase) IsDragging() bool
- func (nb *NodeBase) IsInactive() bool
- func (nb *NodeBase) IsInstaDrag() bool
- func (nb *NodeBase) IsInvisible() bool
- func (nb *NodeBase) IsReRenderAnchor() bool
- func (nb *NodeBase) IsSelected() bool
- func (nb *NodeBase) NeedsFullReRender() bool
- func (nb *NodeBase) ParentCSSAgg() *ki.Props
- func (nb *NodeBase) PointToRelPos(pt image.Point) image.Point
- func (nb *NodeBase) SetActiveState(act bool)
- func (nb *NodeBase) SetActiveStateUpdt(act bool)
- func (nb *NodeBase) SetCanFocus()
- func (nb *NodeBase) SetCanFocusIfActive()
- func (nb *NodeBase) SetFocusState(focus bool)
- func (nb *NodeBase) SetFullReRender()
- func (nb *NodeBase) SetInactive()
- func (nb *NodeBase) SetInactiveState(inact bool)
- func (nb *NodeBase) SetInactiveStateUpdt(inact bool)
- func (nb *NodeBase) SetInvisible()
- func (nb *NodeBase) SetInvisibleState(invis bool)
- func (nb *NodeBase) SetReRenderAnchor()
- func (nb *NodeBase) SetSelected()
- func (nb *NodeBase) SetSelectedState(sel bool)
- func (nb *NodeBase) SetStdXMLAttr(name, val string) bool
- func (nb *NodeBase) StyleProps(selector string) ki.Props
- type NodeFlags
- type Overflow
- type Paint
- func (pc *Paint) AsMask(rs *RenderState) *image.Alpha
- func (pc *Paint) BoundingBox(rs *RenderState, minX, minY, maxX, maxY float32) image.Rectangle
- func (pc *Paint) BoundingBoxFromPoints(rs *RenderState, points []mat32.Vec2) image.Rectangle
- func (pc *Paint) Clear(rs *RenderState)
- func (pc *Paint) ClearPath(rs *RenderState)
- func (pc *Paint) Clip(rs *RenderState)
- func (pc *Paint) ClipPreserve(rs *RenderState)
- func (pc *Paint) ClosePath(rs *RenderState)
- func (pc *Paint) CopyStyleFrom(cp *Paint)
- func (pc *Paint) CubicTo(rs *RenderState, x1, y1, x2, y2, x3, y3 float32)
- func (pc *Paint) Defaults()
- func (pc *Paint) DrawArc(rs *RenderState, x, y, r, angle1, angle2 float32)
- func (pc *Paint) DrawCircle(rs *RenderState, x, y, r float32)
- func (pc *Paint) DrawEllipse(rs *RenderState, x, y, rx, ry float32)
- func (pc *Paint) DrawEllipticalArc(rs *RenderState, cx, cy, rx, ry, angle1, angle2 float32)
- func (pc *Paint) DrawEllipticalArcPath(rs *RenderState, cx, cy, ocx, ocy, pcx, pcy, rx, ry, angle float32, ...) (lx, ly float32)
- func (pc *Paint) DrawImage(rs *RenderState, fmIm image.Image, x, y int)
- func (pc *Paint) DrawImageAnchored(rs *RenderState, fmIm image.Image, x, y int, ax, ay float32)
- func (pc *Paint) DrawLine(rs *RenderState, x1, y1, x2, y2 float32)
- func (pc *Paint) DrawPolygon(rs *RenderState, points []mat32.Vec2)
- func (pc *Paint) DrawPolygonPxToDots(rs *RenderState, points []mat32.Vec2)
- func (pc *Paint) DrawPolyline(rs *RenderState, points []mat32.Vec2)
- func (pc *Paint) DrawPolylinePxToDots(rs *RenderState, points []mat32.Vec2)
- func (pc *Paint) DrawRectangle(rs *RenderState, x, y, w, h float32)
- func (pc *Paint) DrawRegularPolygon(rs *RenderState, n int, x, y, r, rotation float32)
- func (pc *Paint) DrawRoundedRectangle(rs *RenderState, x, y, w, h, r float32)
- func (pc *Paint) Fill(rs *RenderState)
- func (pc *Paint) FillBox(rs *RenderState, pos, size mat32.Vec2, clr *ColorSpec)
- func (pc *Paint) FillBoxColor(rs *RenderState, pos, size mat32.Vec2, clr color.Color)
- func (pc *Paint) FillPreserve(rs *RenderState)
- func (pc *Paint) FillStrokeClear(rs *RenderState)
- func (pc *Paint) HasFill() bool
- func (pc *Paint) HasNoStrokeOrFill() bool
- func (pc *Paint) HasStroke() bool
- func (pc *Paint) Identity()
- func (pc *Paint) InheritFields(par *Paint)
- func (pc *Paint) InvertY(rs *RenderState)
- func (pc *Paint) LineTo(rs *RenderState, x, y float32)
- func (pc *Paint) MoveTo(rs *RenderState, x, y float32)
- func (pc *Paint) NewSubPath(rs *RenderState)
- func (pc *Paint) QuadraticTo(rs *RenderState, x1, y1, x2, y2 float32)
- func (pc *Paint) ResetClip(rs *RenderState)
- func (pc *Paint) Rotate(angle float32)
- func (pc *Paint) RotateAbout(angle, x, y float32)
- func (pc *Paint) Scale(x, y float32)
- func (pc *Paint) ScaleAbout(sx, sy, x, y float32)
- func (pc *Paint) SetMask(rs *RenderState, mask *image.Alpha) error
- func (pc *Paint) SetPixel(rs *RenderState, x, y int)
- func (pc *Paint) SetStyleProps(par *Paint, props ki.Props, vp *Viewport2D)
- func (pc *Paint) SetUnitContext(vp *Viewport2D, el mat32.Vec2)
- func (pc *Paint) SetUnitContextExt(size image.Point)
- func (pc *Paint) Shear(x, y float32)
- func (pc *Paint) ShearAbout(sx, sy, x, y float32)
- func (pc *Paint) Stroke(rs *RenderState)
- func (pc *Paint) StrokePreserve(rs *RenderState)
- func (pc *Paint) StrokeWidth(rs *RenderState) float32
- func (pc *Paint) StyleFromProps(par *Paint, props ki.Props, vp *Viewport2D)
- func (pc *Paint) StyleToDots(uc *units.Context)
- func (pc *Paint) ToDots(uc *units.Context)
- func (pc *Paint) TransformPoint(rs *RenderState, x, y float32) mat32.Vec2
- func (pc *Paint) Translate(x, y float32)
- type Painter
- type ParamPrefs
- type PartsWidgetBase
- func (wb *PartsWidgetBase) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)
- func (wb *PartsWidgetBase) ComputeBBox2DParts(parBBox image.Rectangle, delta image.Point)
- func (wb *PartsWidgetBase) ConfigPartsIconLabel(config *kit.TypeAndNameList, icnm string, txt string) (icIdx, lbIdx int)
- func (wb *PartsWidgetBase) ConfigPartsSetIconLabel(icnm string, txt string, icIdx, lbIdx int)
- func (wb *PartsWidgetBase) CopyFieldsFrom(frm interface{})
- func (wb *PartsWidgetBase) Layout2D(parBBox image.Rectangle, iter int) bool
- func (wb *PartsWidgetBase) Layout2DParts(parBBox image.Rectangle, iter int)
- func (wb *PartsWidgetBase) Move2D(delta image.Point, parBBox image.Rectangle)
- func (wb *PartsWidgetBase) PartsNeedUpdateIconLabel(icnm string, txt string) bool
- func (wb *PartsWidgetBase) Render2DParts()
- func (wb *PartsWidgetBase) SetFullReRenderIconLabel()
- func (wb *PartsWidgetBase) Size2D(iter int)
- func (wb *PartsWidgetBase) Size2DParts(iter int)
- func (wb *PartsWidgetBase) SizeFromParts(iter int)
- type Preferences
- func (pf *Preferences) Apply()
- func (pf *Preferences) ApplyDPI()
- func (pf *Preferences) DarkMode()
- func (pf *Preferences) Defaults()
- func (pf *Preferences) DeleteSavedWindowGeoms()
- func (pf *Preferences) EditDebug()
- func (pf *Preferences) EditDetailed()
- func (pf *Preferences) EditHiStyles()
- func (pf *Preferences) EditKeyMaps()
- func (pf *Preferences) IsDarkMode() bool
- func (pf *Preferences) LightMode()
- func (pf *Preferences) Open() error
- func (pf *Preferences) OpenColors(filename FileName) error
- func (pf *Preferences) Save() error
- func (pf *Preferences) SaveColors(filename FileName) error
- func (pf *Preferences) SaveZoom(forCurrentScreen bool)
- func (pf *Preferences) ScreenInfo() string
- func (pf *Preferences) UpdateAll()
- func (pf *Preferences) UpdateUser()
- func (pf *Preferences) VersionInfo() string
- type PrefsDebug
- type PrefsDetailed
- type RGBAf32
- type Region2D
- type RegionMap2D
- type RenderState
- func (rs *RenderState) BackupPaint()
- func (rs *RenderState) Init(width, height int, img *image.RGBA)
- func (rs *RenderState) Lock()
- func (rs *RenderState) PopBounds()
- func (rs *RenderState) PopClip()
- func (rs *RenderState) PopXForm()
- func (rs *RenderState) PopXFormLock()
- func (rs *RenderState) PushBounds(b image.Rectangle)
- func (rs *RenderState) PushClip()
- func (rs *RenderState) PushXForm(xf mat32.Mat2)
- func (rs *RenderState) PushXFormLock(xf mat32.Mat2)
- func (rs *RenderState) RestorePaint()
- func (rs *RenderState) Unlock()
- type RowCol
- type RuneRender
- type ScreenPrefs
- type ScrollBar
- func (sb *ScrollBar) ConnectEvents2D()
- func (sb *ScrollBar) CopyFieldsFrom(frm interface{})
- func (sb *ScrollBar) Defaults()
- func (sb *ScrollBar) FocusChanged2D(change FocusChanges)
- func (sb *ScrollBar) Init2D()
- func (sb *ScrollBar) Layout2D(parBBox image.Rectangle, iter int) bool
- func (sb *ScrollBar) Move2D(delta image.Point, parBBox image.Rectangle)
- func (sb *ScrollBar) Render2D()
- func (sb *ScrollBar) Render2DDefaultStyle()
- func (sb *ScrollBar) Size2D(iter int)
- func (sb *ScrollBar) Style2D()
- type Separator
- type ShadowStyle
- type Shortcuts
- type SizePrefs
- type SliceLabeler
- type Slider
- func (sr *Slider) ConnectEvents2D()
- func (sr *Slider) CopyFieldsFrom(frm interface{})
- func (sr *Slider) Defaults()
- func (sr *Slider) FocusChanged2D(change FocusChanges)
- func (sr *Slider) Init2D()
- func (sr *Slider) Layout2D(parBBox image.Rectangle, iter int) bool
- func (sr *Slider) Move2D(delta image.Point, parBBox image.Rectangle)
- func (sr *Slider) Render2D()
- func (sr *Slider) Render2DDefaultStyle()
- func (sr *Slider) Size2D(iter int)
- func (sr *Slider) Style2D()
- type SliderBase
- func (sb *SliderBase) ConfigParts()
- func (sb *SliderBase) ConfigPartsIfNeeded(render bool)
- func (sb *SliderBase) CopyFieldsFrom(frm interface{})
- func (sb *SliderBase) Defaults()
- func (sb *SliderBase) Disconnect()
- func (sb *SliderBase) Init2DSlider()
- func (sb *SliderBase) KeyChordEvent()
- func (sb *SliderBase) KeyInput(kt *key.ChordEvent)
- func (sb *SliderBase) MouseDragEvent()
- func (sb *SliderBase) MouseEvent()
- func (sb *SliderBase) MouseFocusEvent()
- func (sb *SliderBase) MouseScrollEvent()
- func (sb *SliderBase) PointToRelPos(pt image.Point) image.Point
- func (sb *SliderBase) SetSliderPos(pos float32)
- func (sb *SliderBase) SetSliderState(state SliderStates)
- func (sb *SliderBase) SetThumbValue(val float32)
- func (sb *SliderBase) SetValue(val float32)
- func (sb *SliderBase) SetValueAction(val float32)
- func (sb *SliderBase) SizeFromAlloc()
- func (sb *SliderBase) SliderEnterHover()
- func (sb *SliderBase) SliderEvents()
- func (sb *SliderBase) SliderExitHover()
- func (sb *SliderBase) SliderMove(start, end float32)
- func (sb *SliderBase) SliderPress(pos float32)
- func (sb *SliderBase) SliderRelease()
- func (sb *SliderBase) SnapValue()
- func (sr *SliderBase) StyleFromProps(props ki.Props, vp *Viewport2D)
- func (sr *SliderBase) StyleSlider()
- func (sr *SliderBase) StyleToDots(uc *units.Context)
- func (sb *SliderBase) UpdatePosFromValue()
- func (sb *SliderBase) UpdateThumbValSize()
- type SliderPositioner
- type SliderSignals
- type SliderStates
- type Space
- type SpanRender
- func (sr *SpanRender) AppendRune(r rune, face font.Face, clr, bg color.Color, deco TextDecorations)
- func (sr *SpanRender) AppendString(str string, face font.Face, clr, bg color.Color, deco TextDecorations, ...)
- func (sr *SpanRender) FindWrapPosLR(trgSize, curSize float32) int
- func (sr *SpanRender) HasDecoUpdate(bg color.Color, deco TextDecorations)
- func (sr *SpanRender) Init(capsz int)
- func (sr *SpanRender) IsNewPara() bool
- func (sr *SpanRender) IsValid() error
- func (sr *SpanRender) LastFont() (face font.Face, color color.Color)
- func (sr *SpanRender) RenderBg(rs *RenderState, tpos mat32.Vec2)
- func (sr *SpanRender) RenderLine(rs *RenderState, tpos mat32.Vec2, deco TextDecorations, ascPct float32)
- func (sr *SpanRender) RenderUnderline(rs *RenderState, tpos mat32.Vec2)
- func (sr *SpanRender) RuneEndPos(idx int) mat32.Vec2
- func (sr *SpanRender) RuneRelPos(idx int) mat32.Vec2
- func (sr *SpanRender) SetNewPara()
- func (sr *SpanRender) SetRenders(sty *FontStyle, ctxt *units.Context, noBG bool, rot, scalex float32)
- func (sr *SpanRender) SetRunePosLR(letterSpace, wordSpace, chsz float32, tabSize int)
- func (sr *SpanRender) SetRunePosTB(letterSpace, wordSpace, chsz float32, tabSize int)
- func (sr *SpanRender) SetRunePosTBRot(letterSpace, wordSpace, chsz float32, tabSize int)
- func (sr *SpanRender) SetRunes(str []rune, sty *FontStyle, ctxt *units.Context, noBG bool, ...)
- func (sr *SpanRender) SetString(str string, sty *FontStyle, ctxt *units.Context, noBG bool, ...)
- func (sr *SpanRender) SizeHV() mat32.Vec2
- func (sr *SpanRender) SplitAtLR(idx int) *SpanRender
- func (sr *SpanRender) TrimSpaceLR()
- func (sr *SpanRender) TrimSpaceLeftLR()
- func (sr *SpanRender) TrimSpaceRightLR()
- func (sr *SpanRender) ZeroPosLR()
- type Spell
- func (sc *Spell) Cancel() bool
- func (sc *Spell) CheckWordInline(word string) ([]string, bool)
- func (sc *Spell) Disconnect()
- func (sc *Spell) IgnoreAllInline()
- func (sc *Spell) KeyInput(kf KeyFuns) bool
- func (sc *Spell) LearnWordInline()
- func (sc *Spell) Show(text string, vp *Viewport2D, pt image.Point)
- func (sc *Spell) ShowNow(word string, vp *Viewport2D, pt image.Point)
- func (sc *Spell) Spell(s string)
- type SpellSignals
- type SpinBox
- func (sb *SpinBox) ConfigParts()
- func (sb *SpinBox) ConfigPartsIfNeeded()
- func (sb *SpinBox) ConnectEvents2D()
- func (sb *SpinBox) CopyFieldsFrom(frm interface{})
- func (sb *SpinBox) Defaults()
- func (sb *SpinBox) Disconnect()
- func (sb *SpinBox) FormatIsInt() bool
- func (sb *SpinBox) HasFocus2D() bool
- func (sb *SpinBox) IncrValue(steps float32)
- func (sb *SpinBox) Init2D()
- func (sb *SpinBox) Layout2D(parBBox image.Rectangle, iter int) bool
- func (sb *SpinBox) MouseScrollEvent()
- func (sb *SpinBox) Render2D()
- func (sb *SpinBox) SetMax(max float32)
- func (sb *SpinBox) SetMin(min float32)
- func (sb *SpinBox) SetMinMax(hasMin bool, min float32, hasMax bool, max float32)
- func (sb *SpinBox) SetValue(val float32)
- func (sb *SpinBox) SetValueAction(val float32)
- func (sb *SpinBox) Size2D(iter int)
- func (sb *SpinBox) SpinBoxEvents()
- func (sb *SpinBox) StringToVal(str string) (float32, error)
- func (sb *SpinBox) Style2D()
- func (sb *SpinBox) StyleFromProps(props ki.Props, vp *Viewport2D)
- func (sb *SpinBox) StyleSpinBox()
- func (sb *SpinBox) TextFieldEvent()
- func (sb *SpinBox) ValToString(val float32) string
- type SplitView
- func (sv *SplitView) CollapseChild(save bool, idxs ...int)
- func (sv *SplitView) ConfigSplitters()
- func (sv *SplitView) ConnectEvents2D()
- func (sv *SplitView) CopyFieldsFrom(frm interface{})
- func (sv *SplitView) EvenSplits()
- func (sv *SplitView) HasFocus2D() bool
- func (sv *SplitView) Init2D()
- func (sv *SplitView) IsCollapsed(idx int) bool
- func (sv *SplitView) KeyChordEvent()
- func (sv *SplitView) KeyInput(kt *key.ChordEvent)
- func (sv *SplitView) Layout2D(parBBox image.Rectangle, iter int) bool
- func (sv *SplitView) Render2D()
- func (sv *SplitView) RestoreChild(idxs ...int)
- func (sv *SplitView) RestoreSplits()
- func (sv *SplitView) SaveSplits()
- func (sv *SplitView) SetSplitAction(idx int, nwval float32)
- func (sv *SplitView) SetSplits(splits ...float32)
- func (sv *SplitView) SetSplitsAction(splits ...float32)
- func (sv *SplitView) SetSplitsList(splits []float32)
- func (sv *SplitView) SplitViewEvents()
- func (sv *SplitView) Style2D()
- func (sv *SplitView) StyleSplitView()
- func (sv *SplitView) UpdateSplits()
- type Splitter
- func (sr *Splitter) ConfigPartsIfNeeded(render bool)
- func (sr *Splitter) ConnectEvents2D()
- func (sr *Splitter) Defaults()
- func (sr *Splitter) FocusChanged2D(change FocusChanges)
- func (sr *Splitter) Init2D()
- func (sr *Splitter) Layout2D(parBBox image.Rectangle, iter int) bool
- func (sr *Splitter) MouseEvent()
- func (sr *Splitter) MouseScrollEvent()
- func (sr *Splitter) PointToRelPos(pt image.Point) image.Point
- func (sr *Splitter) Render2D()
- func (sr *Splitter) Render2DDefaultStyle()
- func (sr *Splitter) Size2D(iter int)
- func (sr *Splitter) SplitView() *SplitView
- func (sr *Splitter) SplitterEvents()
- func (sr *Splitter) Style2D()
- func (sr *Splitter) UpdateSplitterPos()
- type Sprite
- type Sprites
- type Stretch
- type Stripes
- type StrokeStyle
- type Style
- func (s *Style) ApplyCSS(node Node2D, css ki.Props, key, selector string, vp *Viewport2D) bool
- func (s *Style) BoxSpace() float32
- func (s *Style) CopyFrom(cp *Style)
- func (s *Style) CopyUnitContext(ctxt *units.Context)
- func (s *Style) Defaults()
- func (s *Style) FromTemplate() (hasTemplate bool, saveTemplate bool)
- func (s *Style) InheritFields(par *Style)
- func (s *Style) SaveTemplate()
- func (s *Style) SetStyleProps(par *Style, props ki.Props, vp *Viewport2D)
- func (s *Style) SetUnitContext(vp *Viewport2D, el mat32.Vec2)
- func (s *Style) StyleCSS(node Node2D, css ki.Props, selector string, vp *Viewport2D)
- func (s *Style) StyleFromProps(par *Style, props ki.Props, vp *Viewport2D)
- func (s *Style) StyleToDots(uc *units.Context)
- func (s *Style) ToDots(uc *units.Context)
- func (s *Style) Use(vp *Viewport2D)
- type StyleFunc
- type StyleSheet
- type Styler
- type TabButton
- type TabView
- func (tv *TabView) AddNewTab(typ reflect.Type, label string) Node2D
- func (tv *TabView) AddNewTabAction(typ reflect.Type, label string) Node2D
- func (tv *TabView) AddTab(widg Node2D, label string) int
- func (tv *TabView) ConfigNewTabButton() bool
- func (tv *TabView) CopyFieldsFrom(frm interface{})
- func (tv *TabView) CurTab() (Node2D, int, bool)
- func (tv *TabView) DeleteTabIndex(idx int, destroy bool) (Node2D, string, bool)
- func (tv *TabView) DeleteTabIndexAction(idx int)
- func (tv *TabView) Disconnect()
- func (tv *TabView) Frame() *Frame
- func (tv *TabView) InitTabView()
- func (tv *TabView) InsertNewTab(typ reflect.Type, label string, idx int) Node2D
- func (tv *TabView) InsertTab(widg Node2D, label string, idx int)
- func (tv *TabView) InsertTabOnlyAt(widg Node2D, label string, idx int)
- func (tv *TabView) NTabs() int
- func (tv *TabView) RecycleTab(label string, typ reflect.Type, sel bool) Node2D
- func (tv *TabView) Render2D()
- func (tv *TabView) RenderTabSeps()
- func (tv *TabView) RenumberTabs()
- func (tv *TabView) SelectTabByName(label string) Node2D
- func (tv *TabView) SelectTabByNameTry(label string) (Node2D, error)
- func (tv *TabView) SelectTabIndex(idx int) (Node2D, bool)
- func (tv *TabView) SelectTabIndexAction(idx int)
- func (tv *TabView) Style2D()
- func (tv *TabView) TabAtIndex(idx int) (Node2D, *TabButton, bool)
- func (tv *TabView) TabByName(label string) Node2D
- func (tv *TabView) TabByNameTry(label string) (Node2D, error)
- func (tv *TabView) TabIndexByName(label string) (int, error)
- func (tv *TabView) TabName(idx int) string
- func (tv *TabView) Tabs() *Frame
- func (tv *TabView) UnselectOtherTabs(idx int)
- type TabViewSignals
- type TextAnchors
- type TextDecorations
- type TextDirections
- type TextField
- func (tf *TextField) AutoScroll()
- func (tf *TextField) CancelComplete()
- func (tf *TextField) CharStartPos(charidx int, wincoords bool) mat32.Vec2
- func (tf *TextField) Clear()
- func (tf *TextField) ClearCursor()
- func (tf *TextField) ClearSelected()
- func (tf *TextField) CompleteExtend(s string)
- func (tf *TextField) CompleteText(s string)
- func (tf *TextField) ConfigParts()
- func (tf *TextField) ConnectEvents2D()
- func (tf *TextField) Copy(reset bool)
- func (tf *TextField) CopyFieldsFrom(frm interface{})
- func (tf *TextField) CursorBackspace(steps int)
- func (tf *TextField) CursorBackward(steps int)
- func (tf *TextField) CursorDelete(steps int)
- func (tf *TextField) CursorEnd()
- func (tf *TextField) CursorForward(steps int)
- func (tf *TextField) CursorKill()
- func (tf *TextField) CursorSprite() *Sprite
- func (tf *TextField) CursorStart()
- func (tf *TextField) Cut()
- func (tf *TextField) DeleteSelection() string
- func (tf *TextField) Disconnect()
- func (tf *TextField) EditDeFocused()
- func (tf *TextField) EditDone()
- func (tf *TextField) FocusChanged2D(change FocusChanges)
- func (tf *TextField) HandleMouseEvent(me *mouse.Event)
- func (tf *TextField) HasSelection() bool
- func (tf *TextField) Init2D()
- func (tf *TextField) InsertAtCursor(str string)
- func (tf *TextField) IsFocusActive() bool
- func (tf *TextField) IsWordBreak(r rune) bool
- func (tf *TextField) KeyChordEvent()
- func (tf *TextField) KeyInput(kt *key.ChordEvent)
- func (tf *TextField) Layout2D(parBBox image.Rectangle, iter int) bool
- func (tf *TextField) MakeContextMenu(m *Menu)
- func (tf *TextField) MimeData(md *mimedata.Mimes)
- func (tf *TextField) MouseDragEvent()
- func (tf *TextField) MouseEvent()
- func (tf *TextField) MouseFocusEvent()
- func (tf *TextField) OfferComplete(forceComplete bool)
- func (tf *TextField) Paste()
- func (tf *TextField) PixelToCursor(pixOff float32) int
- func (tf *TextField) Render2D()
- func (tf *TextField) RenderCursor(on bool)
- func (tf *TextField) RenderSelect()
- func (tf *TextField) Revert()
- func (tf *TextField) ScrollLayoutToCursor() bool
- func (tf *TextField) SelectAll()
- func (tf *TextField) SelectModeToggle()
- func (tf *TextField) SelectRegUpdate(pos int)
- func (tf *TextField) SelectReset()
- func (tf *TextField) SelectUpdate()
- func (tf *TextField) SelectWord()
- func (tf *TextField) Selection() string
- func (tf *TextField) SetCompleter(data interface{}, matchFun complete.MatchFunc, editFun complete.EditFunc)
- func (tf *TextField) SetCursorFromPixel(pixOff float32, selMode mouse.SelectModes)
- func (tf *TextField) SetText(txt string)
- func (tf *TextField) Size2D(iter int)
- func (tf *TextField) StartCharPos(idx int) float32
- func (tf *TextField) StartCursor()
- func (tf *TextField) StopCursor()
- func (tf *TextField) Style2D()
- func (tf *TextField) StyleTextField()
- func (tf *TextField) Text() string
- func (tf *TextField) TextFieldEvents()
- func (tf *TextField) TextWidth(st, ed int) float32
- func (tf *TextField) UpdateRenderAll() bool
- type TextFieldSignals
- type TextFieldStates
- type TextLink
- type TextLinkHandlerFunc
- type TextRender
- func (tr *TextRender) InsertSpan(at int, ns *SpanRender)
- func (tr *TextRender) LayoutStdLR(txtSty *TextStyle, fontSty *FontStyle, ctxt *units.Context, size mat32.Vec2) mat32.Vec2
- func (tr *TextRender) Render(rs *RenderState, pos mat32.Vec2)
- func (tr *TextRender) RenderTopPos(rs *RenderState, tpos mat32.Vec2)
- func (tx *TextRender) RuneEndPos(idx int) (pos mat32.Vec2, si, ri int, ok bool)
- func (tx *TextRender) RuneRelPos(idx int) (pos mat32.Vec2, si, ri int, ok bool)
- func (tx *TextRender) RuneSpanPos(idx int) (si, ri int, ok bool)
- func (tr *TextRender) SetHTML(str string, font *FontStyle, txtSty *TextStyle, ctxt *units.Context, ...)
- func (tr *TextRender) SetHTMLBytes(str []byte, font *FontStyle, txtSty *TextStyle, ctxt *units.Context, ...)
- func (tr *TextRender) SetHTMLNoPre(str []byte, font *FontStyle, txtSty *TextStyle, ctxt *units.Context, ...)
- func (tr *TextRender) SetHTMLPre(str []byte, font *FontStyle, txtSty *TextStyle, ctxt *units.Context, ...)
- func (tr *TextRender) SetRunes(str []rune, fontSty *FontStyle, ctxt *units.Context, txtSty *TextStyle, ...)
- func (tr *TextRender) SetString(str string, fontSty *FontStyle, ctxt *units.Context, txtSty *TextStyle, ...)
- func (tr *TextRender) SetStringRot90(str string, fontSty *FontStyle, ctxt *units.Context, txtSty *TextStyle, ...)
- func (tx *TextRender) SpanPosToRuneIdx(si, ri int) (idx int, ok bool)
- type TextStyle
- func (ts *TextStyle) AlignFactors() (ax, ay float32)
- func (ts *TextStyle) Defaults()
- func (ts *TextStyle) EffLineHeight() float32
- func (ts *TextStyle) HasPre() bool
- func (ts *TextStyle) HasWordWrap() bool
- func (ts *TextStyle) InheritFields(par *TextStyle)
- func (ts *TextStyle) SetStylePost(props ki.Props)
- func (ts *TextStyle) ToDots(uc *units.Context)
- type ToolBar
- func (tb *ToolBar) AddAction(opts ActOpts, sigTo ki.Ki, fun ki.RecvFunc) *Action
- func (tb *ToolBar) AddSeparator(sepnm string) *Separator
- func (tb *ToolBar) ConnectEvents2D()
- func (tb *ToolBar) CopyFieldsFrom(frm interface{})
- func (tb *ToolBar) DeleteShortcuts()
- func (tb *ToolBar) Destroy()
- func (tb *ToolBar) FindActionByName(name string) (*Action, bool)
- func (tb *ToolBar) MouseFocusEvent()
- func (tb *ToolBar) Render2D()
- func (tb *ToolBar) SetShortcuts()
- func (tb *ToolBar) ToolBarStdRender()
- func (tb *ToolBar) UpdateActions()
- type Transform3D
- type URLHandlerFunc
- type UnicodeBidi
- type Updater
- type User
- type VectorEffects
- type ViewIFace
- type Viewport
- type Viewport2D
- func NewViewport2D(width, height int) *Viewport2D
- func PopupMenu(menu Menu, x, y int, parVp *Viewport2D, name string) *Viewport2D
- func PopupTooltip(tooltip string, x, y int, parVp *Viewport2D, name string) *Viewport2D
- func StringsChooserPopup(strs []string, curSel string, recv Node2D, fun ki.RecvFunc) *Viewport2D
- func ValidViewport(avp *Viewport2D) *Viewport2D
- func (vp *Viewport2D) AsViewport2D() *Viewport2D
- func (vp *Viewport2D) BBox2D() image.Rectangle
- func (vp *Viewport2D) BlockUpdates()
- func (vp *Viewport2D) ChildrenBBox2D() image.Rectangle
- func (vp *Viewport2D) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)
- func (vp *Viewport2D) CopyFieldsFrom(frm interface{})
- func (vp *Viewport2D) CurStyleNodeNamedEl(name string) Node2D
- func (vp *Viewport2D) CurrentColor() Color
- func (vp *Viewport2D) DeletePopup()
- func (vp *Viewport2D) DrawIntoParent(parVp *Viewport2D)
- func (vp *Viewport2D) EncodePNG(w io.Writer) error
- func (vp *Viewport2D) FillViewport()
- func (vp *Viewport2D) FullReRenderIfNeeded() bool
- func (vp *Viewport2D) FullRender2DTree()
- func (vp *Viewport2D) Init2D()
- func (vp *Viewport2D) IsCompleter() bool
- func (vp *Viewport2D) IsCorrector() bool
- func (vp *Viewport2D) IsDoingFullRender() bool
- func (vp *Viewport2D) IsMenu() bool
- func (vp *Viewport2D) IsPopup() bool
- func (vp *Viewport2D) IsSVG() bool
- func (vp *Viewport2D) IsTooltip() bool
- func (vp *Viewport2D) IsUpdatingNode() bool
- func (vp *Viewport2D) IsVisible() bool
- func (vp *Viewport2D) Layout2D(parBBox image.Rectangle, iter int) bool
- func (vp *Viewport2D) Move2D(delta image.Point, parBBox image.Rectangle)
- func (vp *Viewport2D) NeedsFullRender() bool
- func (vp *Viewport2D) NodeUpdated(nii Node2D, sig int64, data interface{})
- func (vp *Viewport2D) PopBounds()
- func (vp *Viewport2D) PrefSize(initSz image.Point) image.Point
- func (vp *Viewport2D) PushBounds() bool
- func (vp *Viewport2D) ReRender2DAnchor(gni Node2D)
- func (vp *Viewport2D) ReRender2DNode(gni Node2D)
- func (vp *Viewport2D) Render2D()
- func (vp *Viewport2D) RenderViewport2D()
- func (vp *Viewport2D) Resize(nwsz image.Point)
- func (vp *Viewport2D) SavePNG(path string) error
- func (vp *Viewport2D) SetCurStyleNode(node Node2D)
- func (vp *Viewport2D) SetCurWin()
- func (vp *Viewport2D) SetCurrentColor(clr Color)
- func (vp *Viewport2D) SetNeedsFullRender()
- func (vp *Viewport2D) Size2D(iter int)
- func (vp *Viewport2D) Style2D()
- func (vp *Viewport2D) UnblockUpdates()
- func (vp *Viewport2D) UpdateLevel(nii Node2D, sig int64, data interface{}) (anchor Node2D, full bool)
- func (vp *Viewport2D) UpdateNode(nii Node2D)
- func (vp *Viewport2D) UpdateNodes()
- func (vp *Viewport2D) VpEventMgr() *EventMgr
- func (vp *Viewport2D) VpIsVisible() bool
- func (vp *Viewport2D) VpTop() Viewport
- func (vp *Viewport2D) VpTopNode() Node
- func (vp *Viewport2D) VpTopUpdateEnd(updt bool)
- func (vp *Viewport2D) VpTopUpdateStart() bool
- func (vp *Viewport2D) VpUploadAll()
- func (vp *Viewport2D) VpUploadRegion(vpBBox, winBBox image.Rectangle)
- func (vp *Viewport2D) VpUploadVp()
- type VpFlags
- type WhiteSpaces
- type WidgetBase
- func (wb *WidgetBase) AddParentPos() mat32.Vec2
- func (wb *WidgetBase) AsWidget() *WidgetBase
- func (wb *WidgetBase) BBox2D() image.Rectangle
- func (wb *WidgetBase) BBoxFromAlloc() image.Rectangle
- func (wb *WidgetBase) ChildrenBBox2D() image.Rectangle
- func (wb *WidgetBase) ChildrenBBox2DWidget() image.Rectangle
- func (wb *WidgetBase) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)
- func (wb *WidgetBase) CopyFieldsFrom(frm interface{})
- func (wb *WidgetBase) DefaultStyle2DWidget(selector string, part *WidgetBase) *Style
- func (wb *WidgetBase) Disconnect()
- func (wb *WidgetBase) EmitContextMenuSignal()
- func (wb *WidgetBase) EmitFocusedSignal()
- func (wb *WidgetBase) EmitSelectedSignal()
- func (wb *WidgetBase) FullReRenderIfNeeded() bool
- func (wb *WidgetBase) HoverTooltipEvent()
- func (wb *WidgetBase) Init2D()
- func (wb *WidgetBase) Init2DWidget()
- func (wb *WidgetBase) InitLayout2D() bool
- func (wb *WidgetBase) Layout2D(parBBox image.Rectangle, iter int) bool
- func (wb *WidgetBase) Layout2DBase(parBBox image.Rectangle, initStyle bool, iter int)
- func (wb *WidgetBase) MakeContextMenu(m *Menu)
- func (wb *WidgetBase) Move2D(delta image.Point, parBBox image.Rectangle)
- func (wb *WidgetBase) Move2DBase(delta image.Point, parBBox image.Rectangle)
- func (wb *WidgetBase) Move2DTree()
- func (wb *WidgetBase) ParentLayout() *Layout
- func (wb *WidgetBase) PopBounds()
- func (wb *WidgetBase) PushBounds() bool
- func (wb *WidgetBase) ReRender2DTree()
- func (wb *WidgetBase) Render2D()
- func (wb *WidgetBase) RenderBoxImpl(pos mat32.Vec2, sz mat32.Vec2, rad float32)
- func (wb *WidgetBase) RenderStdBox(st *Style)
- func (wb *WidgetBase) Size2D(iter int)
- func (wb *WidgetBase) Size2DAddSpace()
- func (wb *WidgetBase) Size2DBase(iter int)
- func (wb *WidgetBase) Size2DFromWH(w, h float32)
- func (wb *WidgetBase) Size2DSubSpace() mat32.Vec2
- func (wb *WidgetBase) Style() *Style
- func (wb *WidgetBase) Style2D()
- func (wb *WidgetBase) Style2DWidget()
- func (wb *WidgetBase) StylePart(pk Node2D)
- func (wb *WidgetBase) WidgetMouseEvents(sel, ctxtMenu bool)
- type WidgetSignals
- type WinEventRecv
- type WinEventRecvList
- type WinFlags
- type Window
- func NewDialogWin(name, title string, width, height int, modal bool) *Window
- func NewMainWindow(name, title string, width, height int) *Window
- func NewWindow(name, title string, opts *oswin.NewWindowOptions) *Window
- func RecycleDialogWin(data interface{}, name, title string, width, height int, modal bool) (*Window, bool)
- func RecycleMainWindow(data interface{}, name, title string, width, height int) (*Window, bool)
- func WindowInFocus() *Window
- func (w *Window) ActivateSprite(nm string)
- func (w *Window) AddDirectUploader(node Node2D)
- func (w *Window) AddMainMenu() *MenuBar
- func (w *Window) AddNewSprite(nm string, sz image.Point, pos image.Point) *Sprite
- func (w *Window) AddShortcut(chord key.Chord, act *Action)
- func (w *Window) AddSprite(sp *Sprite)
- func (w *Window) BenchmarkFullRender()
- func (w *Window) BenchmarkReRender()
- func (w *Window) ClearDragNDrop()
- func (w *Window) ClearWinUpdating()
- func (w *Window) Close()
- func (w *Window) ClosePopup(pop ki.Ki) bool
- func (w *Window) CloseReq()
- func (w *Window) Closed()
- func (w *Window) ConfigVLay()
- func (w *Window) CurPopup() ki.Ki
- func (w *Window) CurPopupIsTooltip() bool
- func (w *Window) DNDClearCursor()
- func (w *Window) DNDDropEvent(e *mouse.Event)
- func (w *Window) DNDMoveEvent(e *mouse.DragEvent)
- func (w *Window) DNDNotCursor()
- func (w *Window) DNDSetCursor(dmod dnd.DropMods)
- func (w *Window) DNDUpdateCursor(dmod dnd.DropMods) bool
- func (w *Window) DeleteDirectUploader(node Node2D)
- func (w *Window) DeleteShortcut(chord key.Chord, act *Action)
- func (w *Window) DeleteSprite(nm string) bool
- func (w *Window) DeleteTooltip()
- func (w *Window) DirectUpdate(du Node2D)
- func (w *Window) DirectUploads()
- func (w *Window) DisconnectPopup(pop ki.Ki)
- func (w *Window) EventLoop()
- func (w *Window) EventTopNode() ki.Ki
- func (w *Window) EventTopUpdateEnd(updt bool)
- func (w *Window) EventTopUpdateStart() bool
- func (w *Window) FilterEvent(evi oswin.Event) bool
- func (w *Window) FinalizeDragNDrop(action dnd.DropMods)
- func (w *Window) FocusActiveClick(e *mouse.Event)
- func (w *Window) FocusInactivate()
- func (w *Window) FocusTopNode() ki.Ki
- func (w *Window) FullReRender()
- func (w *Window) GoStartEventLoop()
- func (w *Window) HasGeomPrefs() bool
- func (w *Window) HiPriorityEvents(evi oswin.Event) bool
- func (w *Window) InactivateAllSprites()
- func (w *Window) InactivateSprite(nm string)
- func (w *Window) InitialFocus()
- func (w *Window) IsClosed() bool
- func (w *Window) IsClosing() bool
- func (w *Window) IsFocusActive() bool
- func (w *Window) IsInScope(ni *Node2DBase, popup bool) bool
- func (w *Window) IsResizing() bool
- func (w *Window) IsVisible() bool
- func (w *Window) IsWinUpdating() bool
- func (w *Window) IsWindowInFocus() bool
- func (w *Window) KeyChordEventHiPri(e *key.ChordEvent) bool
- func (w *Window) KeyChordEventLowPri(e *key.ChordEvent) bool
- func (w *Window) LogicalDPI() float32
- func (w *Window) MainFrame() (*Frame, error)
- func (w *Window) MainMenuSet()
- func (w *Window) MainMenuUpdateActives()
- func (w *Window) MainMenuUpdateWindows()
- func (w *Window) MainMenuUpdated()
- func (w *Window) MainWidget() (ki.Ki, error)
- func (w *Window) MakeOverTex() bool
- func (w *Window) NeedWinMenuUpdate() bool
- func (w *Window) PollEvents()
- func (w *Window) PopPopup(pop ki.Ki) bool
- func (w *Window) ProcessEvent(evi oswin.Event)
- func (w *Window) Publish()
- func (w *Window) PublishFullReRender()
- func (w *Window) PushPopup(pop ki.Ki)
- func (w *Window) RenderOverlays()
- func (w *Window) RenderSprite(sp *Sprite)
- func (w *Window) ReportWinNodes()
- func (w *Window) Resized(sz image.Point)
- func (w *Window) SendCustomEvent(data interface{})
- func (w *Window) SendShowEvent()
- func (w *Window) SendWinFocusEvent(act window.Actions)
- func (w *Window) SetCloseCleanFunc(fun func(win *Window))
- func (w *Window) SetCloseReqFunc(fun func(win *Window))
- func (w *Window) SetDelPopup(pop ki.Ki)
- func (w *Window) SetFocusActiveState(active bool)
- func (w *Window) SetMainFrame() *Frame
- func (w *Window) SetMainLayout() *Layout
- func (w *Window) SetMainWidget(mw ki.Ki)
- func (w *Window) SetMainWidgetType(typ reflect.Type, name string) ki.Ki
- func (w *Window) SetName(name string) bool
- func (w *Window) SetNextPopup(pop, focus ki.Ki)
- func (w *Window) SetPixSize(sz image.Point)
- func (w *Window) SetSize(sz image.Point)
- func (w *Window) SetTitle(name string)
- func (w *Window) SetWinUpdating()
- func (w *Window) ShouldDeletePopupMenu(pop ki.Ki, me *mouse.Event) bool
- func (w *Window) SpriteByName(nm string) (*Sprite, bool)
- func (w *Window) StartDragNDrop(src ki.Ki, data mimedata.Mimes, sp *Sprite)
- func (w *Window) StartEventLoop()
- func (w *Window) StopEventLoop()
- func (w *Window) TriggerShortcut(chord key.Chord) bool
- func (w *Window) UploadAllViewports()
- func (w *Window) UploadVp(vp *Viewport2D, offset image.Point)
- func (w *Window) UploadVpRegion(vp *Viewport2D, vpBBox, winBBox image.Rectangle)
- func (w *Window) WinViewport2D() *Viewport2D
- func (w *Window) ZoomDPI(steps int)
- type WindowGeom
- func (wg *WindowGeom) FitInSize(sz image.Point)
- func (wg *WindowGeom) Pos() image.Point
- func (wg *WindowGeom) ScalePos(fact float32)
- func (wg *WindowGeom) ScaleSize(fact float32)
- func (wg *WindowGeom) SetPos(ps image.Point)
- func (wg *WindowGeom) SetSize(sz image.Point)
- func (wg *WindowGeom) Size() image.Point
- type WindowGeomPrefs
- func (wg *WindowGeomPrefs) DeleteAll()
- func (wg *WindowGeomPrefs) LockFile() error
- func (wg *WindowGeomPrefs) NeedToReload() bool
- func (wg *WindowGeomPrefs) Open() error
- func (wg *WindowGeomPrefs) Pref(winName string, scrn *oswin.Screen) *WindowGeom
- func (wg *WindowGeomPrefs) RecordPref(win *Window)
- func (wg *WindowGeomPrefs) Save() error
- func (wg *WindowGeomPrefs) SaveLastSave()
- func (wg *WindowGeomPrefs) UnlockFile()
- type WindowList
- func (wl *WindowList) Add(w *Window)
- func (wl *WindowList) Delete(w *Window) bool
- func (wl *WindowList) FindData(data interface{}) (*Window, bool)
- func (wl *WindowList) FindName(name string) (*Window, bool)
- func (wl *WindowList) FindOSWin(osw oswin.Window) (*Window, bool)
- func (wl *WindowList) FocusNext() (*Window, int)
- func (wl *WindowList) Focused() (*Window, int)
- func (wl *WindowList) Len() int
- func (wl *WindowList) Win(idx int) *Window
Constants ¶
const ( AddOk = true NoOk = false AddCancel = true NoCancel = false )
Dialog Ok, Cancel options
const ( // Popups means include popups Popups = true // NoPopups means exclude popups NoPopups = false )
const ( X = mat32.X Y = mat32.Y )
const ( Version = "v1.0.1" GitCommit = "811f1f7" // the commit JUST BEFORE the release VersionDate = "2020-04-08 08:23" // UTC )
const DNDSpriteName = "gi.Window:DNDSprite"
const MaxDx float32 = math.Pi / 8
MaxDx is the Maximum radians a cubic splice is allowed to span in ellipse parametric when approximating an off-axis ellipse.
Variables ¶
var ( ColorModel color.Model = color.ModelFunc(colorModel) RGBAf32Model color.Model = color.ModelFunc(rgbaf32Model) NRGBAf32Model color.Model = color.ModelFunc(nrgbaf32Model) HSLAModel color.Model = color.ModelFunc(hslaf32Model) )
var ActionProps = ki.Props{ "EnumType:Flag": KiT_ButtonFlags, "border-width": units.NewPx(0), "border-radius": units.NewPx(0), "border-color": &Prefs.Colors.Border, "text-align": AlignCenter, "background-color": &Prefs.Colors.Control, "color": &Prefs.Colors.Font, "padding": units.NewPx(2), "margin": units.NewPx(2), "min-width": units.NewEm(1), "min-height": units.NewEm(1), "#icon": ki.Props{ "width": units.NewEm(1), "height": units.NewEm(1), "margin": units.NewPx(0), "padding": units.NewPx(0), "fill": &Prefs.Colors.Icon, "stroke": &Prefs.Colors.Font, }, "#space": ki.Props{ "width": units.NewCh(.5), "min-width": units.NewCh(.5), }, "#label": ki.Props{ "margin": units.NewPx(0), "padding": units.NewPx(0), }, "#indicator": ki.Props{ "width": units.NewEx(1.5), "height": units.NewEx(1.5), "margin": units.NewPx(0), "padding": units.NewPx(0), "vertical-align": AlignBottom, "fill": &Prefs.Colors.Icon, "stroke": &Prefs.Colors.Font, }, "#ind-stretch": ki.Props{ "width": units.NewEm(1), }, "#shortcut": ki.Props{ "margin": units.NewPx(0), "padding": units.NewPx(0), }, "#sc-stretch": ki.Props{ "min-width": units.NewCh(2), }, ".menu-action": ki.Props{ "padding": units.NewPx(2), "margin": units.NewPx(0), "max-width": -1, "indicator": "wedge-right", ButtonSelectors[ButtonActive]: ki.Props{ "background-color": "lighter-0", }, ButtonSelectors[ButtonInactive]: ki.Props{ "border-color": "highlight-50", "color": "highlight-50", }, ButtonSelectors[ButtonHover]: ki.Props{ "background-color": "highlight-10", }, ButtonSelectors[ButtonFocus]: ki.Props{ "border-width": units.NewPx(2), "background-color": "samelight-50", }, ButtonSelectors[ButtonDown]: ki.Props{ "color": "highlight-90", "background-color": "highlight-30", }, ButtonSelectors[ButtonSelected]: ki.Props{ "background-color": &Prefs.Colors.Select, }, }, ".menubar-action": ki.Props{ "padding": units.NewPx(4), "margin": units.NewPx(0), "indicator": "none", "border-width": units.NewPx(0), ButtonSelectors[ButtonActive]: ki.Props{ "background-color": "linear-gradient(lighter-0, highlight-10)", }, ButtonSelectors[ButtonInactive]: ki.Props{ "border-color": "lighter-50", "color": "lighter-50", }, ButtonSelectors[ButtonHover]: ki.Props{ "background-color": "linear-gradient(highlight-10, highlight-10)", }, ButtonSelectors[ButtonFocus]: ki.Props{ "border-width": units.NewPx(2), "background-color": "linear-gradient(samelight-50, highlight-10)", }, ButtonSelectors[ButtonDown]: ki.Props{ "color": "lighter-90", "background-color": "linear-gradient(highlight-30, highlight-10)", }, ButtonSelectors[ButtonSelected]: ki.Props{ "background-color": "linear-gradient(pref(Select), highlight-10)", }, }, ".toolbar-action": ki.Props{ "padding": units.NewPx(4), "margin": units.NewPx(0), "indicator": "none", "border-width": units.NewPx(0.5), ButtonSelectors[ButtonActive]: ki.Props{ "background-color": "linear-gradient(lighter-0, highlight-10)", }, ButtonSelectors[ButtonInactive]: ki.Props{ "border-color": "lighter-50", "color": "lighter-50", }, ButtonSelectors[ButtonHover]: ki.Props{ "background-color": "linear-gradient(highlight-10, highlight-10)", }, ButtonSelectors[ButtonFocus]: ki.Props{ "border-width": units.NewPx(2), "background-color": "linear-gradient(samelight-50, highlight-10)", }, ButtonSelectors[ButtonDown]: ki.Props{ "color": "lighter-90", "background-color": "linear-gradient(highlight-30, highlight-10)", }, ButtonSelectors[ButtonSelected]: ki.Props{ "background-color": "linear-gradient(pref(Select), highlight-10)", }, }, ".": ki.Props{ ButtonSelectors[ButtonActive]: ki.Props{ "background-color": "linear-gradient(lighter-0, highlight-10)", }, ButtonSelectors[ButtonInactive]: ki.Props{ "border-color": "lighter-50", "color": "lighter-50", }, ButtonSelectors[ButtonHover]: ki.Props{ "background-color": "linear-gradient(highlight-10, highlight-10)", }, ButtonSelectors[ButtonFocus]: ki.Props{ "border-width": units.NewPx(2), "background-color": "linear-gradient(samelight-50, highlight-10)", }, ButtonSelectors[ButtonDown]: ki.Props{ "color": "lighter-90", "background-color": "linear-gradient(highlight-30, highlight-10)", }, ButtonSelectors[ButtonSelected]: ki.Props{ "background-color": "linear-gradient(pref(Select), highlight-10)", }, }, }
var AutoScrollRate = float32(1.0)
AutoScrollRate determines the rate of auto-scrolling of layouts
var AvailKeyMapsChanged = false
AvailKeyMapsChanged is used to update giv.KeyMapsView toolbars via following menu, toolbar props update methods -- not accurate if editing any other map but works for now..
var BitmapProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "background-color": &Prefs.Colors.Background, "ToolBar": ki.PropSlice{ {"OpenImage", ki.Props{ "desc": "Open an image for this bitmap. if width and/or height is > 0, then image is rescaled to that dimension, preserving aspect ratio if other one is not set", "icon": "file-open", "Args": ki.PropSlice{ {"File Name", ki.Props{ "default-field": "Filename", "ext": ".png,.jpg", }}, {"Width", ki.Props{ "desc": "width in raw display dots -- use image size if 0", }}, {"Height", ki.Props{ "desc": "height in raw display dots -- use image size if 0", }}, }, }}, }, }
var ButtonBaseProps = ki.Props{ "base-type": true, "EnumType:Flag": KiT_ButtonFlags, }
var ButtonBoxProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "border-width": units.NewPx(1), "border-radius": units.NewPx(2), "border-color": &Prefs.Colors.Border, "padding": units.NewPx(2), "margin": units.NewPx(2), "text-align": AlignCenter, "background-color": &Prefs.Colors.Control, "color": &Prefs.Colors.Font, }
var ButtonProps = ki.Props{ "EnumType:Flag": KiT_ButtonFlags, "border-width": units.NewPx(1), "border-radius": units.NewPx(4), "border-color": &Prefs.Colors.Border, "padding": units.NewPx(4), "margin": units.NewPx(2), "min-width": units.NewEm(1), "min-height": units.NewEm(1), "text-align": AlignCenter, "background-color": &Prefs.Colors.Control, "color": &Prefs.Colors.Font, "#space": ki.Props{ "width": units.NewCh(.5), "min-width": units.NewCh(.5), }, "#icon": ki.Props{ "width": units.NewEm(1), "height": units.NewEm(1), "margin": units.NewPx(0), "padding": units.NewPx(0), "fill": &Prefs.Colors.Icon, "stroke": &Prefs.Colors.Font, }, "#label": ki.Props{ "margin": units.NewPx(0), "padding": units.NewPx(0), }, "#indicator": ki.Props{ "width": units.NewEx(1.5), "height": units.NewEx(1.5), "margin": units.NewPx(0), "padding": units.NewPx(0), "vertical-align": AlignBottom, "fill": &Prefs.Colors.Icon, "stroke": &Prefs.Colors.Font, }, "#ind-stretch": ki.Props{ "width": units.NewEm(1), }, ButtonSelectors[ButtonActive]: ki.Props{ "background-color": "linear-gradient(lighter-0, highlight-10)", }, ButtonSelectors[ButtonInactive]: ki.Props{ "border-color": "lighter-50", "color": "lighter-50", }, ButtonSelectors[ButtonHover]: ki.Props{ "background-color": "linear-gradient(highlight-10, highlight-10)", }, ButtonSelectors[ButtonFocus]: ki.Props{ "border-width": units.NewPx(2), "background-color": "linear-gradient(samelight-50, highlight-10)", }, ButtonSelectors[ButtonDown]: ki.Props{ "color": "lighter-90", "background-color": "linear-gradient(highlight-30, highlight-10)", }, ButtonSelectors[ButtonSelected]: ki.Props{ "background-color": "linear-gradient(pref(Select), highlight-10)", }, }
var ButtonSelectors = []string{":active", ":inactive", ":hover", ":focus", ":down", ":selected"}
Style selector names for the different states: https://www.w3schools.com/cssref/css_selectors.asp
var CheckBoxProps = ki.Props{ "EnumType:Flag": KiT_ButtonFlags, "icon": "checked-box", "icon-off": "unchecked-box", "text-align": AlignLeft, "color": &Prefs.Colors.Font, "background-color": &Prefs.Colors.Control, "margin": units.NewPx(1), "padding": units.NewPx(1), "border-width": units.NewPx(0), "#icon0": ki.Props{ "width": units.NewEm(1), "height": units.NewEm(1), "margin": units.NewPx(0), "padding": units.NewPx(0), "background-color": color.Transparent, "fill": &Prefs.Colors.Control, "stroke": &Prefs.Colors.Font, }, "#icon1": ki.Props{ "width": units.NewEm(1), "height": units.NewEm(1), "margin": units.NewPx(0), "padding": units.NewPx(0), "background-color": color.Transparent, "fill": &Prefs.Colors.Control, "stroke": &Prefs.Colors.Font, }, "#space": ki.Props{ "width": units.NewCh(0.1), }, "#label": ki.Props{ "margin": units.NewPx(0), "padding": units.NewPx(0), }, ButtonSelectors[ButtonActive]: ki.Props{ "background-color": "lighter-0", }, ButtonSelectors[ButtonInactive]: ki.Props{ "border-color": "highlight-50", "color": "highlight-50", }, ButtonSelectors[ButtonHover]: ki.Props{ "background-color": "highlight-10", }, ButtonSelectors[ButtonFocus]: ki.Props{ "border-width": units.NewPx(2), "background-color": "samelight-50", }, ButtonSelectors[ButtonDown]: ki.Props{ "color": "highlight-90", "background-color": "highlight-30", }, ButtonSelectors[ButtonSelected]: ki.Props{ "background-color": &Prefs.Colors.Select, }, }
var ColorPrefsProps = ki.Props{ "ToolBar": ki.PropSlice{ {"OpenJSON", ki.Props{ "label": "Open...", "icon": "file-open", "desc": "open set of colors from a json-formatted file", "Args": ki.PropSlice{ {"Color File Name", ki.Props{ "ext": ".json", }}, }, }}, {"SaveJSON", ki.Props{ "label": "Save As...", "desc": "Saves colors to JSON formatted file.", "icon": "file-save", "Args": ki.PropSlice{ {"Color File Name", ki.Props{ "ext": ".json", }}, }, }}, {"SetToPrefs", ki.Props{ "desc": "Sets this color scheme as the current active color scheme in Prefs.", "icon": "reset", }}, }, }
ColorPrefsProps defines the ToolBar
var ColorProps = ki.Props{ "style-prop": true, }
var ColorSpecCache map[string]*ColorSpec
ColorSpecCache is a cache of named color specs -- only a few are constantly re-used so we save them in the cache instead of constantly recomputing!
var ComboBoxProps = ki.Props{ "EnumType:Flag": KiT_ButtonFlags, "border-width": units.NewPx(1), "border-radius": units.NewPx(4), "border-color": &Prefs.Colors.Border, "padding": units.NewPx(4), "margin": units.NewPx(4), "text-align": AlignCenter, "background-color": &Prefs.Colors.Control, "color": &Prefs.Colors.Font, "#icon": ki.Props{ "width": units.NewEm(1), "height": units.NewEm(1), "margin": units.NewPx(0), "padding": units.NewPx(0), "fill": &Prefs.Colors.Icon, "stroke": &Prefs.Colors.Font, }, "#label": ki.Props{ "margin": units.NewPx(0), "padding": units.NewPx(0), }, "#text": ki.Props{ "margin": units.NewPx(1), "padding": units.NewPx(1), "max-width": -1, "width": units.NewCh(12), }, "#indicator": ki.Props{ "width": units.NewEx(1.5), "height": units.NewEx(1.5), "margin": units.NewPx(0), "padding": units.NewPx(0), "vertical-align": AlignBottom, "fill": &Prefs.Colors.Icon, "stroke": &Prefs.Colors.Font, }, "#ind-stretch": ki.Props{ "width": units.NewEm(1), }, ButtonSelectors[ButtonActive]: ki.Props{ "background-color": "linear-gradient(lighter-0, highlight-10)", }, ButtonSelectors[ButtonInactive]: ki.Props{ "border-color": "highlight-50", "color": "highlight-50", }, ButtonSelectors[ButtonHover]: ki.Props{ "background-color": "linear-gradient(highlight-10, highlight-10)", }, ButtonSelectors[ButtonFocus]: ki.Props{ "border-width": units.NewPx(2), "background-color": "linear-gradient(samelight-50, highlight-10)", }, ButtonSelectors[ButtonDown]: ki.Props{ "color": "highlight-90", "background-color": "linear-gradient(highlight-30, highlight-10)", }, ButtonSelectors[ButtonSelected]: ki.Props{ "background-color": "linear-gradient(pref(Select), highlight-10)", "color": "highlight-90", }, }
var CompleteMaxItems = 25
CompleteMaxItems is the max number of items to display in completer popup
var CompleteWaitMSec = 500
CompleteWaitMSec is the number of milliseconds to wait before showing the completion menu
var CurIconList []IconName
CurIconList holds the current icon list, alpha sorted -- set at startup
var CursorBlinkMSec = 500
CursorBlinkMSec is number of milliseconds that cursor blinks on and off -- set to 0 to disable blinking
var CustomAppMenuFunc = (func(m *Menu, win *Window))(nil)
CustomAppMenuFunc is a function called by AddAppMenu after the AddStdAppMenu is called -- apps can set this function to add / modify / etc the menu
var DNDStartMSec = 200
DNDStartMSec is the number of milliseconds to wait before initiating a drag-n-drop event -- gotta drag it like you mean it
var DNDStartPix = 20
DNDStartPix is the number of pixels that must be moved before initiating a drag-n-drop event -- gotta drag it like you mean it
var DNDTrace = false
DNDTrace can be set to true to get a trace of the DND process
var DefaultKeyMap = KeyMapName("MacEmacs")
DefaultKeyMap is the overall default keymap -- reinitialized in gimain init() depending on platform
var DefaultPaths = FavPaths{
{"home", "home", "~"},
{"desktop", "Desktop", "~/Desktop"},
{"documents", "Documents", "~/Documents"},
{"folder-download", "Downloads", "~/Downloads"},
{"computer", "root", "/"},
}
DefaultPaths are default favorite paths
var DialogProps = ki.Props{ "EnumType:Flag": KiT_VpFlags, "color": &Prefs.Colors.Font, "#frame": ki.Props{ "border-width": units.NewPx(2), "margin": units.NewPx(8), "padding": units.NewPx(4), "box-shadow.h-offset": units.NewPx(4), "box-shadow.v-offset": units.NewPx(4), "box-shadow.blur": units.NewPx(4), "box-shadow.color": &Prefs.Colors.Shadow, }, "#title": ki.Props{ "max-width": units.NewPx(-1), "text-align": AlignCenter, "vertical-align": AlignTop, "background-color": "none", "font-size": "large", }, "#prompt": ki.Props{ "white-space": WhiteSpaceNormal, "max-width": -1, "width": units.NewCh(30), "text-align": AlignLeft, "vertical-align": AlignTop, "background-color": "none", }, }
var DialogsSepWindow = true
DialogsSepWindow determines if dialog windows open in a separate OS-level window, or do they open within the same parent window. If only within parent window, then they are always effectively modal.
var DragStartMSec = 50
DragStartMSec is the number of milliseconds to wait before initiating a regular mouse drag event (as opposed to a basic mouse.Press)
var DragStartPix = 4
DragStartPix is the number of pixels that must be moved before initiating a regular mouse drag event (as opposed to a basic mouse.Press)
var EventSkipLagMSec = 50
EventSkipLagMSec is the number of milliseconds of lag between the time the event was sent to the time it is being processed, above which a repeated event type (scroll, drag, resize) is skipped
var EventTrace = false
EventTrace reports a trace of event handing to stdout. can be set in PrefsDebug from prefs gui
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 FilterLaggyKeyEvents = false
FilterLaggyKeyEvents -- set to true to apply laggy filter to KeyEvents (normally excluded)
var FocusWindows []string
FocusWindows is a "recents" stack of window names that have focus when a window gets focus, it pops to the top of this list when a window is closed, it is removed from the list, and the top item on the list gets focused.
var FontExts = map[string]struct{}{
".ttf": struct{}{},
".ttc": struct{}{},
}
var FontFallbacks = map[string]string{
"serif": "Times New Roman",
"times": "Times New Roman",
"Times New Roman": "Liberation Serif",
"Liberation Serif": "NotoSerif",
"sans-serif": "NotoSans",
"NotoSans": "Go",
"courier": "Courier",
"Courier": "Courier New",
"Courier New": "NotoSansMono",
"NotoSansMono": "Go Mono",
"monospace": "NotoSansMono",
"cursive": "Comic Sans",
"Comic Sans": "Comic Sans MS",
"fantasy": "Impact",
"Impact": "Impac",
}
FontFallbacks are a list of fallback fonts to try, at the basename level. Make sure there are no loops! Include Noto versions of everything in this because they have the most stretch options, so they should be in the mix if they have been installed, and include "Go" options last.
var FontInfoExample = "AaBbCcIiPpQq12369$€¢?.:/()àáâãäåæç日本中国⇧⌘"
FontInfoExample is example text to demonstrate fonts -- from Inkscape plus extra
var FontSizePoints = map[string]float32{
"xx-small": 7,
"x-small": 7.5,
"small": 10,
"smallf": 10,
"medium": 12,
"large": 14,
"x-large": 18,
"xx-large": 24,
}
FontSizePoints maps standard font names to standard point sizes -- we use dpi zoom scaling instead of rescaling "medium" font size, so generally use these values as-is. smaller and larger relative scaling can move in 2pt increments
var FontStretchNames = []string{"Normal", "UltraCondensed", "ExtraCondensed", "SemiCondensed", "SemiExpanded", "ExtraExpanded", "UltraExpanded", "Condensed", "Expanded", "Condensed", "Expanded"}
FontStretchNames contains the uppercase names of all the valid font stretches used in the regularized font names. The first name is the baseline default and will be omitted from font names. Order must have names that are subsets of other names at the end so they only match if the more specific one hasn't! And also match the FontStretch enum.
var FontStyleNames = []string{"Normal", "Italic", "Oblique"}
FontStyleNames contains the uppercase names of all the valid font styles used in the regularized font names. The first name is the baseline default and will be omitted from font names.
var FontWeightNameVals = []FontWeights{WeightNormal, WeightThin, WeightExtraLight, WeightLight, WeightMedium, WeightSemiBold, WeightExtraBold, WeightBold, WeightBlack}
FontWeightNameVals is 1-to-1 index map from FontWeightNames to corresponding weight value (using more semantic term instead of numerical one)
var FontWeightNames = []string{"Normal", "Thin", "ExtraLight", "Light", "Medium", "SemiBold", "ExtraBold", "Bold", "Black"}
FontWeightNames contains the uppercase names of all the valid font weights used in the regularized font names. The first name is the baseline default and will be omitted from font names. Order must have names that are subsets of other names at the end so they only match if the more specific one hasn't!
var FontWeightToNameMap = map[FontWeights]string{ Weight100: "Thin", WeightThin: "Thin", Weight200: "ExtraLight", WeightExtraLight: "ExtraLight", Weight300: "Light", WeightLight: "Light", Weight400: "", WeightNormal: "", Weight500: "Medium", WeightMedium: "Medium", Weight600: "SemiBold", WeightSemiBold: "SemiBold", Weight700: "Bold", WeightBold: "Bold", Weight800: "ExtraBold", WeightExtraBold: "ExtraBold", Weight900: "Black", WeightBlack: "Black", WeightBolder: "Medium", WeightLighter: "Light", }
FontWeightToNameMap maps all the style enums to canonical regularized font names
var FrameProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "border-width": units.NewPx(2), "border-radius": units.NewPx(0), "border-color": &Prefs.Colors.Border, "padding": units.NewPx(2), "margin": units.NewPx(2), "color": &Prefs.Colors.Font, "background-color": &Prefs.Colors.Background, }
var GoFonts = map[string]GoFontInfo{ "gofont/goregular": {"Go", goregular.TTF}, "gofont/gobold": {"Go Bold", gobold.TTF}, "gofont/gobolditalic": {"Go Bold Italic", gobolditalic.TTF}, "gofont/goitalic": {"Go Italic", goitalic.TTF}, "gofont/gomedium": {"Go Medium", gomedium.TTF}, "gofont/gomediumitalic": {"Go Medium Italic", gomediumitalic.TTF}, "gofont/gomono": {"Go Mono", gomono.TTF}, "gofont/gomonobold": {"Go Mono Bold", gomonobold.TTF}, "gofont/gomonobolditalic": {"Go Mono Bold Italic", gomonobolditalic.TTF}, "gofont/gomonoitalic": {"Go Mono Italic", gomonoitalic.TTF}, "gofont/gosmallcaps": {"Go Small Caps", gosmallcaps.TTF}, "gofont/gosmallcapsitalic": {"Go Small Caps Italic", gosmallcapsitalic.TTF}, }
var GradientDegToSides = map[string]string{
"0deg": "top",
"360deg": "top",
"45deg": "top right",
"-315deg": "top right",
"90deg": "right",
"-270deg": "right",
"135deg": "bottom right",
"-225deg": "bottom right",
"180deg": "bottom",
"-180deg": "bottom",
"225deg": "bottom left",
"-135deg": "bottom left",
"270deg": "left",
"-90deg": "left",
"315deg": "top left",
"-45deg": "top left",
}
GradientDegToSides maps gradient degree notation to side notation
var HoverMaxPix = 5
HoverMaxPix is the maximum number of pixels that mouse can move and still register a Hover event
var HoverStartMSec = 1000
HoverStartMSec is the number of milliseconds to wait before initiating a hover event (e.g., for opening a tooltip)
var IconProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "background-color": color.Transparent, }
var KeyEventTrace = false
KeyEventTrace reports a trace of keyboard events to stdout can be set in PrefsDebug from prefs gui
var KeyMapsProps = ki.Props{ "MainMenu": ki.PropSlice{ {"AppMenu", ki.BlankProp{}}, {"File", ki.PropSlice{ {"OpenPrefs", ki.Props{}}, {"SavePrefs", ki.Props{ "shortcut": KeyFunMenuSave, "updtfunc": func(kmi interface{}, act *Action) { act.SetActiveState(AvailKeyMapsChanged && kmi.(*KeyMaps) == &AvailKeyMaps) }, }}, {"sep-file", ki.BlankProp{}}, {"OpenJSON", ki.Props{ "label": "Open from file", "desc": "You can save and open key maps to / from files to share, experiment, transfer, etc", "shortcut": KeyFunMenuOpen, "Args": ki.PropSlice{ {"File Name", ki.Props{ "ext": ".json", }}, }, }}, {"SaveJSON", ki.Props{ "label": "Save to file", "desc": "You can save and open key maps to / from files to share, experiment, transfer, etc", "shortcut": KeyFunMenuSaveAs, "Args": ki.PropSlice{ {"File Name", ki.Props{ "ext": ".json", }}, }, }}, {"RevertToStd", ki.Props{ "desc": "This reverts the keymaps to using the StdKeyMaps that are compiled into the program and have all the lastest key functions defined. If you have edited your maps, and are finding things not working, it is a good idea to save your current maps and try this, or at least do ViewStdMaps to see the current standards. <b>Your current map edits will be lost if you proceed!</b> Continue?", "confirm": true, }}, }}, {"Edit", "Copy Cut Paste Dupe"}, {"Window", "Windows"}, }, "ToolBar": ki.PropSlice{ {"SavePrefs", ki.Props{ "desc": "saves KeyMaps to GoGi standard prefs directory, in file key_maps_prefs.json, which will be loaded automatically at startup if prefs SaveKeyMaps is checked (should be if you're using custom keymaps)", "icon": "file-save", "updtfunc": func(kmi interface{}, act *Action) { act.SetActiveState(AvailKeyMapsChanged && kmi.(*KeyMaps) == &AvailKeyMaps) }, }}, {"sep-file", ki.BlankProp{}}, {"OpenJSON", ki.Props{ "label": "Open from file", "icon": "file-open", "desc": "You can save and open key maps to / from files to share, experiment, transfer, etc", "Args": ki.PropSlice{ {"File Name", ki.Props{ "ext": ".json", }}, }, }}, {"SaveJSON", ki.Props{ "label": "Save to file", "icon": "file-save", "desc": "You can save and open key maps to / from files to share, experiment, transfer, etc", "Args": ki.PropSlice{ {"File Name", ki.Props{ "ext": ".json", }}, }, }}, {"sep-std", ki.BlankProp{}}, {"ViewStd", ki.Props{ "desc": "Shows the standard maps that are compiled into the program and have all the lastest key functions bound to standard key chords. Useful for comparing against custom maps.", "confirm": true, "updtfunc": func(kmi interface{}, act *Action) { act.SetActiveStateUpdt(kmi.(*KeyMaps) != &StdKeyMaps) }, }}, {"RevertToStd", ki.Props{ "icon": "update", "desc": "This reverts the keymaps to using the StdKeyMaps that are compiled into the program and have all the lastest key functions bound to standard key chords. If you have edited your maps, and are finding things not working, it is a good idea to save your current maps and try this, or at least do ViewStdMaps to see the current standards. <b>Your current map edits will be lost if you proceed!</b> Continue?", "confirm": true, "updtfunc": func(kmi interface{}, act *Action) { act.SetActiveStateUpdt(kmi.(*KeyMaps) != &StdKeyMaps) }, }}, }, }
KeyMapsProps define the ToolBar and MenuBar for TableView of KeyMaps, e.g., giv.KeyMapsView
var KiT_Action = kit.Types.AddType(&Action{}, ActionProps)
var KiT_Align = kit.Enums.AddEnumAltLower(AlignN, kit.NotBitFlag, StylePropProps, "Align")
var KiT_BaselineShifts = kit.Enums.AddEnumAltLower(BaselineShiftsN, kit.NotBitFlag, StylePropProps, "Shift")
var KiT_Bitmap = kit.Types.AddType(&Bitmap{}, BitmapProps)
var KiT_BorderDrawStyle = kit.Enums.AddEnumAltLower(BorderN, kit.NotBitFlag, StylePropProps, "Border")
var KiT_BoxSides = kit.Enums.AddEnumAltLower(BoxN, kit.NotBitFlag, StylePropProps, "Box")
var KiT_Button = kit.Types.AddType(&Button{}, ButtonProps)
var KiT_ButtonBase = kit.Types.AddType(&ButtonBase{}, ButtonBaseProps)
var KiT_ButtonBox = kit.Types.AddType(&ButtonBox{}, ButtonBoxProps)
var KiT_ButtonFlags = kit.Enums.AddEnumExt(KiT_NodeFlags, ButtonFlagsN, kit.BitFlag, nil)
var KiT_ButtonStates = kit.Enums.AddEnumAltLower(ButtonStatesN, kit.NotBitFlag, StylePropProps, "Button")
var KiT_CheckBox = kit.Types.AddType(&CheckBox{}, CheckBoxProps)
var KiT_Color = kit.Types.AddType(&Color{}, ColorProps)
var KiT_ColorPrefs = kit.Types.AddType(&ColorPrefs{}, ColorPrefsProps)
var KiT_ColorSources = kit.Enums.AddEnumAltLower(ColorSourcesN, kit.NotBitFlag, StylePropProps, "")
var KiT_ColorSpec = kit.Types.AddType(&ColorSpec{}, nil)
var KiT_ComboBox = kit.Types.AddType(&ComboBox{}, ComboBoxProps)
var KiT_Complete = kit.Types.AddType(&Complete{}, nil)
var KiT_Dialog = kit.Types.AddType(&Dialog{}, DialogProps)
var KiT_FillRules = kit.Enums.AddEnumAltLower(FillRulesN, kit.NotBitFlag, StylePropProps, "FillRules")
var KiT_FontStretch = kit.Enums.AddEnumAltLower(FontStretchN, kit.NotBitFlag, StylePropProps, "FontStr")
var KiT_FontStyles = kit.Enums.AddEnumAltLower(FontStylesN, kit.NotBitFlag, StylePropProps, "Font")
var KiT_FontVariants = kit.Enums.AddEnumAltLower(FontVariantsN, kit.NotBitFlag, StylePropProps, "FontVar")
var KiT_FontWeights = kit.Enums.AddEnumAltLower(FontWeightsN, kit.NotBitFlag, StylePropProps, "Weight")
var KiT_Frame = kit.Types.AddType(&Frame{}, FrameProps)
var KiT_Gradient = kit.Types.AddType(&Gradient{}, nil)
var KiT_Icon = kit.Types.AddType(&Icon{}, IconProps)
var KiT_KeyFuns = kit.Enums.AddEnumAltLower(KeyFunsN, kit.NotBitFlag, StylePropProps, "KeyFun")
var KiT_KeyMaps = kit.Types.AddType(&KeyMaps{}, KeyMapsProps)
var KiT_Label = kit.Types.AddType(&Label{}, LabelProps)
var KiT_LabelStates = kit.Enums.AddEnumAltLower(LabelStatesN, kit.NotBitFlag, StylePropProps, "Label")
var KiT_Layout = kit.Types.AddType(&Layout{}, LayoutProps)
var KiT_Layouts = kit.Enums.AddEnumAltLower(LayoutsN, kit.NotBitFlag, StylePropProps, "Layout")
var KiT_LineCaps = kit.Enums.AddEnumAltLower(LineCapsN, kit.NotBitFlag, StylePropProps, "LineCaps")
var KiT_LineJoins = kit.Enums.AddEnumAltLower(LineJoinsN, kit.NotBitFlag, StylePropProps, "LineJoins")
var KiT_MenuBar = kit.Types.AddType(&MenuBar{}, MenuBarProps)
var KiT_MenuButton = kit.Types.AddType(&MenuButton{}, MenuButtonProps)
var KiT_MetaData2D = kit.Types.AddType(&MetaData2D{}, nil)
var KiT_Node2DBase = kit.Types.AddType(&Node2DBase{}, Node2DBaseProps)
var KiT_NodeBase = kit.Types.AddType(&NodeBase{}, NodeBaseProps)
var KiT_NodeFlags = kit.Enums.AddEnumExt(ki.KiT_Flags, NodeFlagsN, kit.BitFlag, nil)
var KiT_Overflow = kit.Enums.AddEnumAltLower(OverflowN, kit.NotBitFlag, StylePropProps, "Overflow")
var KiT_PartsWidgetBase = kit.Types.AddType(&PartsWidgetBase{}, PartsWidgetBaseProps)
var KiT_Preferences = kit.Types.AddType(&Preferences{}, PreferencesProps)
var KiT_PrefsDebug = kit.Types.AddType(&PrefsDebug{}, PrefsDebugProps)
var KiT_PrefsDetailed = kit.Types.AddType(&PrefsDetailed{}, PrefsDetailedProps)
var KiT_RowCol = kit.Enums.AddEnumAltLower(RowColN, kit.NotBitFlag, StylePropProps, "")
var KiT_ScrollBar = kit.Types.AddType(&ScrollBar{}, ScrollBarProps)
var KiT_Separator = kit.Types.AddType(&Separator{}, SeparatorProps)
var KiT_Slider = kit.Types.AddType(&Slider{}, SliderProps)
var KiT_SliderBase = kit.Types.AddType(&SliderBase{}, SliderBaseProps)
var KiT_Space = kit.Types.AddType(&Space{}, SpaceProps)
var KiT_Spell = kit.Types.AddType(&Spell{}, nil)
var KiT_SpinBox = kit.Types.AddType(&SpinBox{}, SpinBoxProps)
var KiT_SplitView = kit.Types.AddType(&SplitView{}, SplitViewProps)
var KiT_Splitter = kit.Types.AddType(&Splitter{}, SplitterProps)
var KiT_Stretch = kit.Types.AddType(&Stretch{}, StretchProps)
var KiT_Stripes = kit.Enums.AddEnumAltLower(StripesN, kit.NotBitFlag, StylePropProps, "Stripes")
var KiT_StyleSheet = kit.Types.AddType(&StyleSheet{}, nil)
var KiT_TabButton = kit.Types.AddType(&TabButton{}, TabButtonProps)
var KiT_TabView = kit.Types.AddType(&TabView{}, TabViewProps)
var KiT_TextAnchors = kit.Enums.AddEnumAltLower(TextAnchorsN, kit.NotBitFlag, StylePropProps, "Anchor")
var KiT_TextDecorations = kit.Enums.AddEnumAltLower(TextDecorationsN, kit.BitFlag, StylePropProps, "Deco")
var KiT_TextDirections = kit.Enums.AddEnumAltLower(TextDirectionsN, kit.NotBitFlag, StylePropProps, "")
var KiT_TextField = kit.Types.AddType(&TextField{}, TextFieldProps)
var KiT_ToolBar = kit.Types.AddType(&ToolBar{}, ToolBarProps)
var KiT_UnicodeBidi = kit.Enums.AddEnumAltLower(UnicodeBidiN, kit.NotBitFlag, StylePropProps, "Bidi")
var KiT_VectorEffects = kit.Enums.AddEnumAltLower(VecEffN, kit.NotBitFlag, StylePropProps, "VecEff")
var KiT_Viewport2D = kit.Types.AddType(&Viewport2D{}, Viewport2DProps)
var KiT_VpFlags = kit.Enums.AddEnumExt(KiT_NodeFlags, VpFlagsN, kit.BitFlag, nil)
var KiT_WhiteSpaces = kit.Enums.AddEnumAltLower(WhiteSpacesN, kit.NotBitFlag, StylePropProps, "WhiteSpace")
var KiT_WidgetBase = kit.Types.AddType(&WidgetBase{}, WidgetBaseProps)
var KiT_WinFlags = kit.Enums.AddEnumExt(KiT_NodeFlags, WinFlagsN, kit.BitFlag, nil)
var KiT_Window = kit.Types.AddType(&Window{}, WindowProps)
var LabelProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "white-space": WhiteSpacePre, "padding": units.NewPx(2), "margin": units.NewPx(2), "vertical-align": AlignTop, "color": &Prefs.Colors.Font, "background-color": color.Transparent, LabelSelectors[LabelActive]: ki.Props{ "background-color": color.Transparent, }, LabelSelectors[LabelInactive]: ki.Props{ "color": "lighter-50", }, LabelSelectors[LabelSelected]: ki.Props{ "background-color": &Prefs.Colors.Select, }, }
var LabelSelectors = []string{":active", ":inactive", ":selected"}
LabelSelectors are Style selector names for the different states:
var Layout2DTrace bool = false
Layout2DTrace reports a trace of all layouts (just printfs to stdout) -- can be set in PrefsDebug from prefs gui
var LayoutAutoScrollDelayMSec = 25
LayoutAutoScrollDelayMSec is amount of time to wait (in Milliseconds) before trying to autoscroll again
var LayoutFocusNameTabMSec = 2000
LayoutFocusNameTabMSec is the number of milliseconds since last focus name event to allow tab to focus on next element with same name.
var LayoutFocusNameTimeoutMSec = 500
LayoutFocusNameTimeoutMSec is the number of milliseconds between keypresses to combine characters into name to search for within layout -- starts over after this delay.
var LayoutLastAutoScroll time.Time
var LayoutPageSteps = 10
LayoutPageSteps is the number of steps to take in PageUp / Down events in terms of number of items.
var LayoutPrefMaxCols = 20
LayoutPrefMaxCols is maximum number of columns to use in a grid layout when computing the preferred size (VpFlagPrefSizing)
var LayoutPrefMaxRows = 20
LayoutPrefMaxRows is maximum number of rows to use in a grid layout when computing the preferred size (VpFlagPrefSizing)
var LayoutProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, }
var LocalMainMenu = false
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.
var MenuBarProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "padding": units.NewPx(2), "margin": units.NewPx(0), "spacing": units.NewPx(4), "color": &Prefs.Colors.Font, "background-color": "linear-gradient(pref(Control), highlight-10)", }
var MenuButtonProps = ki.Props{ "EnumType:Flag": KiT_ButtonFlags, "border-width": units.NewPx(1), "border-radius": units.NewPx(4), "border-color": &Prefs.Colors.Border, "border-style": BorderSolid, "padding": units.NewPx(4), "margin": units.NewPx(4), "box-shadow.color": &Prefs.Colors.Shadow, "text-align": AlignCenter, "background-color": &Prefs.Colors.Control, "color": &Prefs.Colors.Font, "#icon": ki.Props{ "width": units.NewEm(1), "height": units.NewEm(1), "margin": units.NewPx(0), "padding": units.NewPx(0), "fill": &Prefs.Colors.Icon, "stroke": &Prefs.Colors.Font, }, "#label": ki.Props{ "margin": units.NewPx(0), "padding": units.NewPx(0), }, "#indicator": ki.Props{ "width": units.NewEx(1.5), "height": units.NewEx(1.5), "margin": units.NewPx(0), "padding": units.NewPx(0), "vertical-align": AlignBottom, "fill": &Prefs.Colors.Icon, "stroke": &Prefs.Colors.Font, }, "#ind-stretch": ki.Props{ "width": units.NewEm(1), }, ButtonSelectors[ButtonActive]: ki.Props{ "background-color": "linear-gradient(lighter-0, highlight-10)", }, ButtonSelectors[ButtonInactive]: ki.Props{ "border-color": "highlight-50", "color": "highlight-50", }, ButtonSelectors[ButtonHover]: ki.Props{ "background-color": "linear-gradient(highlight-10, highlight-10)", }, ButtonSelectors[ButtonFocus]: ki.Props{ "border-width": units.NewPx(2), "background-color": "linear-gradient(samelight-50, highlight-10)", }, ButtonSelectors[ButtonDown]: ki.Props{ "color": "highlight-90", "background-color": "linear-gradient(highlight-30, highlight-10)", }, ButtonSelectors[ButtonSelected]: ki.Props{ "background-color": "linear-gradient(pref(Select), highlight-10)", }, }
var MenuFrameProps = ki.Props{ "border-width": units.NewPx(0), "border-color": "none", "margin": units.NewPx(4), "padding": units.NewPx(2), "box-shadow.h-offset": units.NewPx(2), "box-shadow.v-offset": units.NewPx(2), "box-shadow.blur": units.NewPx(2), "box-shadow.color": &Prefs.Colors.Shadow, }
var MenuMaxHeight = 30
MenuMaxHeight is the maximum height of any menu popup panel in units of font height scroll bars are enforced beyond that size.
var MenuTextSeparator = "-------------"
Separator defines a string to indicate a menu separator item
var Node2DBaseProps = ki.Props{ "base-type": true, "EnumType:Flag": KiT_NodeFlags, }
var NodeBaseProps = ki.Props{ "base-type": true, "EnumType:Flag": KiT_NodeFlags, }
var PartsWidgetBaseProps = ki.Props{ "base-type": true, "EnumType:Flag": KiT_NodeFlags, }
var PreferencesProps = ki.Props{ "MainMenu": ki.PropSlice{ {"AppMenu", ki.BlankProp{}}, {"File", ki.PropSlice{ {"UpdateAll", ki.Props{}}, {"Open", ki.Props{ "shortcut": KeyFunMenuOpen, }}, {"Save", ki.Props{ "shortcut": KeyFunMenuSave, "updtfunc": func(pfi interface{}, act *Action) { pf := pfi.(*Preferences) act.SetActiveState(pf.Changed) }, }}, {"sep-color", ki.BlankProp{}}, {"LightMode", ki.Props{}}, {"DarkMode", ki.Props{}}, {"sep-misc", ki.BlankProp{}}, {"SaveZoom", ki.Props{ "desc": "Save current zoom magnification factor, either for all screens or for the current screen only", "Args": ki.PropSlice{ {"For Current Screen Only?", ki.Props{ "desc": "click this to save zoom specifically for current screen", }}, }, }}, {"DeleteSavedWindowGeoms", ki.Props{ "confirm": true, "desc": "Are you <i>sure</i>? This deletes the file that saves the position and size of each window, by screen, and clear current in-memory cache. You shouldn't generally need to do this but sometimes it is useful for testing or windows are showing up in bad places that you can't recover from.", }}, {"sep-close", ki.BlankProp{}}, {"Close Window", ki.BlankProp{}}, }}, {"Edit", "Copy Cut Paste"}, {"Window", "Windows"}, }, "ToolBar": ki.PropSlice{ {"UpdateAll", ki.Props{ "desc": "Updates all open windows with current preferences -- triggers rebuild of default styles.", "icon": "update", }}, {"sep-file", ki.BlankProp{}}, {"Save", ki.Props{ "desc": "Saves current preferences to standard prefs.json file, which is auto-loaded at startup.", "icon": "file-save", "updtfunc": func(pfi interface{}, act *Action) { pf := pfi.(*Preferences) act.SetActiveStateUpdt(pf.Changed) }, }}, {"sep-color", ki.BlankProp{}}, {"LightMode", ki.Props{ "desc": "Set color mode to Light mode as defined in ColorSchemes -- automatically does Save and UpdateAll ", "icon": "color", }}, {"DarkMode", ki.Props{ "desc": "Set color mode to Dark mode as defined in ColorSchemes -- automatically does Save and UpdateAll", "icon": "color", }}, {"sep-scrn", ki.BlankProp{}}, {"SaveZoom", ki.Props{ "icon": "zoom-in", "desc": "Save current zoom magnification factor, either for all screens or for the current screen only", "Args": ki.PropSlice{ {"For Current Screen Only?", ki.Props{ "desc": "click this to save zoom specifically for current screen", }}, }, }}, {"ScreenInfo", ki.Props{ "desc": "shows parameters about all the active screens", "icon": "info", "show-return": true, }}, {"VersionInfo", ki.Props{ "desc": "shows current GoGi version information", "icon": "info", "show-return": true, }}, {"sep-key", ki.BlankProp{}}, {"EditKeyMaps", ki.Props{ "icon": "keyboard", "desc": "opens the KeyMapsView editor to create new keymaps / save / load from other files, etc. Current keymaps are saved and loaded with preferences automatically if SaveKeyMaps is clicked (will be turned on automatically if you open this editor).", }}, {"EditHiStyles", ki.Props{ "icon": "file-binary", "desc": "opens the HiStylesView editor of highlighting styles.", }}, {"EditDetailed", ki.Props{ "icon": "file-binary", "desc": "opens the PrefsDetView editor to edit detailed params that are not typically user-modified, but can be if you really care.. Turns on the SaveDetailed flag so these will be saved and loaded automatically -- can toggle that back off if you don't actually want to.", }}, {"EditDebug", ki.Props{ "icon": "file-binary", "desc": "Opens the PrefsDbgView editor to control debugging parameters. These are not saved -- only set dynamically during running.", }}, }, }
PreferencesProps define the ToolBar and MenuBar for StructView, e.g., giv.PrefsView
var Prefs = Preferences{}
Prefs are the overall preferences
var PrefsDbg = PrefsDebug{}
PrefsDbg are the overall debugging preferences
var PrefsDebugProps = ki.Props{ "ToolBar": ki.PropSlice{ {"Profile", ki.Props{ "desc": "Toggle profiling of program on or off -- does both targeted and global CPU and Memory profiling.", "icon": "update", }}, }, }
PrefsDebugProps define the ToolBar and MenuBar for StructView, e.g., giv.PrefsDbgView
var PrefsDet = PrefsDetailed{}
PrefsDet are the overall detailed preferences
var PrefsDetailedFileName = "prefs_det.json"
PrefsDetailedFileName is the name of the detailed preferences file in GoGi prefs directory
var PrefsDetailedProps = ki.Props{ "MainMenu": ki.PropSlice{ {"AppMenu", ki.BlankProp{}}, {"File", ki.PropSlice{ {"Apply", ki.Props{}}, {"Open", ki.Props{ "shortcut": KeyFunMenuOpen, }}, {"Save", ki.Props{ "shortcut": KeyFunMenuSave, "updtfunc": func(pfi interface{}, act *Action) { pf := pfi.(*PrefsDetailed) act.SetActiveState(pf.Changed) }, }}, {"Close Window", ki.BlankProp{}}, }}, {"Edit", "Copy Cut Paste"}, {"Window", "Windows"}, }, "ToolBar": ki.PropSlice{ {"Apply", ki.Props{ "desc": "Apply parameters to affect actual behavior.", "icon": "update", }}, {"sep-file", ki.BlankProp{}}, {"Save", ki.Props{ "desc": "Saves current preferences to standard prefs_det.json file, which is auto-loaded at startup.", "icon": "file-save", "updtfunc": func(pfi interface{}, act *Action) { pf := pfi.(*PrefsDetailed) act.SetActiveStateUpdt(pf.Changed) }, }}, }, }
PrefsDetailedProps define the ToolBar and MenuBar for StructView, e.g., giv.PrefsDetView
var PrefsFileName = "prefs.json"
PrefsFileName is the name of the preferences file in GoGi prefs directory
var PrefsKeyMapsFileName = "key_maps_prefs.json"
PrefsKeyMapsFileName is the name of the preferences file in GoGi prefs directory for saving / loading the default AvailKeyMaps key maps list
var RebuildDefaultStyles bool
RebuildDefaultStyles is a global state var used by Prefs to trigger rebuild of all the default styles, which are otherwise compiled and not updated
var Render2DTrace bool = false
Render2DTrace reports a trace of the nodes rendering (just printfs to stdout) -- can be set in PrefsDebug from prefs gui
var SavedPathsExtras = []string{MenuTextSeparator, FileViewResetPaths, FileViewEditPaths}
SavedPathsExtras are the reset and edit items we add to the recents menu
var SavedPathsFileName = "saved_paths.json"
SavedPathsFileName is the name of the saved file paths file in GoGi prefs directory
var ScrollBarProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "border-width": units.NewPx(1), "border-radius": units.NewPx(4), "border-color": &Prefs.Colors.Border, "padding": units.NewPx(0), "margin": units.NewPx(2), "background-color": &Prefs.Colors.Control, "color": &Prefs.Colors.Font, SliderSelectors[SliderActive]: ki.Props{ "background-color": "lighter-0", }, SliderSelectors[SliderInactive]: ki.Props{ "border-color": "highlight-50", "color": "highlight-50", }, SliderSelectors[SliderHover]: ki.Props{ "background-color": "highlight-10", }, SliderSelectors[SliderFocus]: ki.Props{ "border-width": units.NewPx(2), "background-color": "samelight-50", }, SliderSelectors[SliderDown]: ki.Props{ "background-color": "highlight-20", }, SliderSelectors[SliderValue]: ki.Props{ "border-color": &Prefs.Colors.Icon, "background-color": &Prefs.Colors.Icon, }, SliderSelectors[SliderBox]: ki.Props{ "border-color": &Prefs.Colors.Background, "background-color": &Prefs.Colors.Background, }, }
var SeparatorProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "padding": units.NewPx(0), "margin": units.NewPx(0), "vertical-align": AlignCenter, "horizontal-align": AlignCenter, "border-color": &Prefs.Colors.Border, "border-width": units.NewPx(2), "background-color": &Prefs.Colors.Control, }
var SliderBaseProps = ki.Props{ "base-type": true, "EnumType:Flag": KiT_NodeFlags, }
var SliderMinThumbSize = float32(8)
SliderMinThumbSize is the minimum thumb size, even if computed value would make it smaller
var SliderProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "border-width": units.NewPx(1), "border-radius": units.NewPx(4), "border-color": &Prefs.Colors.Border, "padding": units.NewPx(6), "margin": units.NewPx(4), "background-color": &Prefs.Colors.Control, "color": &Prefs.Colors.Font, "#icon": ki.Props{ "width": units.NewEm(1), "height": units.NewEm(1), "margin": units.NewPx(0), "padding": units.NewPx(0), "fill": &Prefs.Colors.Icon, "stroke": &Prefs.Colors.Font, }, SliderSelectors[SliderActive]: ki.Props{ "background-color": "lighter-0", }, SliderSelectors[SliderInactive]: ki.Props{ "border-color": "highlight-50", "color": "highlight-50", }, SliderSelectors[SliderHover]: ki.Props{ "background-color": "highlight-10", }, SliderSelectors[SliderFocus]: ki.Props{ "border-width": units.NewPx(2), "background-color": "samelight-50", }, SliderSelectors[SliderDown]: ki.Props{ "background-color": "highlight-20", }, SliderSelectors[SliderValue]: ki.Props{ "border-color": &Prefs.Colors.Icon, "background-color": &Prefs.Colors.Icon, }, SliderSelectors[SliderBox]: ki.Props{ "border-color": &Prefs.Colors.Background, "background-color": &Prefs.Colors.Background, }, }
var SliderSelectors = []string{":active", ":inactive", ":hover", ":focus", ":down", ":value", ":box"}
SliderSelectors are Style selector names for the different states
var SpaceProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "width": units.NewCh(1), "height": units.NewEm(1), }
var SpinBoxProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "#buttons": ki.Props{ "vertical-align": AlignMiddle, }, "#up": ki.Props{ "max-width": units.NewEx(1.5), "max-height": units.NewEx(1.5), "margin": units.NewPx(1), "padding": units.NewPx(0), "fill": &Prefs.Colors.Icon, "stroke": &Prefs.Colors.Font, }, "#down": ki.Props{ "max-width": units.NewEx(1.5), "max-height": units.NewEx(1.5), "margin": units.NewPx(1), "padding": units.NewPx(0), "fill": &Prefs.Colors.Icon, "stroke": &Prefs.Colors.Font, }, "#space": ki.Props{ "width": units.NewCh(.1), }, "#text-field": ki.Props{ "min-width": units.NewCh(4), "width": units.NewCh(8), "margin": units.NewPx(2), "padding": units.NewPx(2), "clear-act": false, }, }
var SplitViewProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "handle-size": units.NewPx(10), "max-width": -1.0, "max-height": -1.0, "margin": 0, "padding": 0, }
var SplitterProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "padding": units.NewPx(6), "margin": units.NewPx(0), "background-color": &Prefs.Colors.Background, "color": &Prefs.Colors.Font, "#icon": ki.Props{ "max-width": units.NewEm(1), "max-height": units.NewEm(5), "min-width": units.NewEm(1), "min-height": units.NewEm(5), "margin": units.NewPx(0), "padding": units.NewPx(0), "vertical-align": AlignMiddle, "fill": &Prefs.Colors.Icon, "stroke": &Prefs.Colors.Font, }, SliderSelectors[SliderActive]: ki.Props{}, SliderSelectors[SliderInactive]: ki.Props{ "border-color": "highlight-50", "color": "highlight-50", }, SliderSelectors[SliderHover]: ki.Props{ "background-color": "highlight-10", }, SliderSelectors[SliderFocus]: ki.Props{ "border-width": units.NewPx(2), "background-color": "samelight-50", }, SliderSelectors[SliderDown]: ki.Props{}, SliderSelectors[SliderValue]: ki.Props{ "border-color": &Prefs.Colors.Icon, "background-color": &Prefs.Colors.Icon, }, SliderSelectors[SliderBox]: ki.Props{ "border-color": &Prefs.Colors.Background, "background-color": &Prefs.Colors.Background, }, }
var StdDialogVSpace = float32(1)
standard vertical space between elements in a dialog, in Ex units
var StdDialogVSpaceUnits = units.Value{Val: StdDialogVSpace, Un: units.Ex, Dots: 0}
var StdKeyMaps = KeyMaps{ {"MacStd", "Standard Mac KeyMap", KeyMap{ "UpArrow": KeyFunMoveUp, "Shift+UpArrow": KeyFunMoveUp, "Meta+UpArrow": KeyFunMoveUp, "Control+P": KeyFunMoveUp, "Shift+Control+P": KeyFunMoveUp, "Meta+Control+P": KeyFunMoveUp, "DownArrow": KeyFunMoveDown, "Shift+DownArrow": KeyFunMoveDown, "Meta+DownArrow": KeyFunMoveDown, "Control+N": KeyFunMoveDown, "Shift+Control+N": KeyFunMoveDown, "Meta+Control+N": KeyFunMoveDown, "RightArrow": KeyFunMoveRight, "Shift+RightArrow": KeyFunMoveRight, "Meta+RightArrow": KeyFunEnd, "Control+F": KeyFunMoveRight, "Shift+Control+F": KeyFunMoveRight, "Meta+Control+F": KeyFunMoveRight, "LeftArrow": KeyFunMoveLeft, "Shift+LeftArrow": KeyFunMoveLeft, "Meta+LeftArrow": KeyFunHome, "Control+B": KeyFunMoveLeft, "Shift+Control+B": KeyFunMoveLeft, "Meta+Control+B": KeyFunMoveLeft, "PageUp": KeyFunPageUp, "Shift+PageUp": KeyFunPageUp, "Control+UpArrow": KeyFunPageUp, "Control+U": KeyFunPageUp, "PageDown": KeyFunPageDown, "Shift+PageDown": KeyFunPageDown, "Control+DownArrow": KeyFunPageDown, "Shift+Control+V": KeyFunPageDown, "Alt+√": KeyFunPageDown, "Meta+Home": KeyFunDocHome, "Shift+Home": KeyFunDocHome, "Meta+H": KeyFunDocHome, "Meta+End": KeyFunDocEnd, "Shift+End": KeyFunDocEnd, "Meta+L": KeyFunDocEnd, "Control+RightArrow": KeyFunWordRight, "Control+LeftArrow": KeyFunWordLeft, "Alt+RightArrow": KeyFunWordRight, "Shift+Alt+RightArrow": KeyFunWordRight, "Alt+LeftArrow": KeyFunWordLeft, "Shift+Alt+LeftArrow": KeyFunWordLeft, "Home": KeyFunHome, "Control+A": KeyFunHome, "Shift+Control+A": KeyFunHome, "End": KeyFunEnd, "Control+E": KeyFunEnd, "Shift+Control+E": KeyFunEnd, "Tab": KeyFunFocusNext, "Shift+Tab": KeyFunFocusPrev, "ReturnEnter": KeyFunEnter, "KeypadEnter": KeyFunEnter, "Meta+A": KeyFunSelectAll, "Control+G": KeyFunCancelSelect, "Control+Spacebar": KeyFunSelectMode, "Control+ReturnEnter": KeyFunAccept, "Escape": KeyFunAbort, "DeleteBackspace": KeyFunBackspace, "Control+DeleteBackspace": KeyFunBackspaceWord, "Alt+DeleteBackspace": KeyFunBackspaceWord, "DeleteForward": KeyFunDelete, "Control+DeleteForward": KeyFunDeleteWord, "Alt+DeleteForward": KeyFunDeleteWord, "Control+D": KeyFunDelete, "Control+K": KeyFunKill, "Alt+∑": KeyFunCopy, "Meta+C": KeyFunCopy, "Control+W": KeyFunCut, "Meta+X": KeyFunCut, "Control+Y": KeyFunPaste, "Control+V": KeyFunPaste, "Meta+V": KeyFunPaste, "Shift+Meta+V": KeyFunPasteHist, "Alt+D": KeyFunDuplicate, "Control+T": KeyFunTranspose, "Alt+T": KeyFunTransposeWord, "Control+Z": KeyFunUndo, "Meta+Z": KeyFunUndo, "Shift+Control+Z": KeyFunRedo, "Shift+Meta+Z": KeyFunRedo, "Control+I": KeyFunInsert, "Control+O": KeyFunInsertAfter, "Shift+Meta+=": KeyFunZoomIn, "Meta+=": KeyFunZoomIn, "Meta+-": KeyFunZoomOut, "Control+=": KeyFunZoomIn, "Shift+Control++": KeyFunZoomIn, "Shift+Meta+-": KeyFunZoomOut, "Control+-": KeyFunZoomOut, "Shift+Control+_": KeyFunZoomOut, "Control+Alt+P": KeyFunPrefs, "F5": KeyFunRefresh, "Control+L": KeyFunRecenter, "Control+.": KeyFunComplete, "Control+,": KeyFunLookup, "Control+S": KeyFunSearch, "Meta+F": KeyFunFind, "Meta+R": KeyFunReplace, "Control+J": KeyFunJump, "Control+[": KeyFunHistPrev, "Control+]": KeyFunHistNext, "Meta+[": KeyFunHistPrev, "Meta+]": KeyFunHistNext, "F10": KeyFunMenu, "Meta+`": KeyFunWinFocusNext, "Meta+W": KeyFunWinClose, "Control+Alt+G": KeyFunWinSnapshot, "Shift+Control+G": KeyFunWinSnapshot, "Control+Alt+I": KeyFunGoGiEditor, "Shift+Control+I": KeyFunGoGiEditor, "Meta+N": KeyFunMenuNew, "Shift+Meta+N": KeyFunMenuNewAlt1, "Alt+Meta+N": KeyFunMenuNewAlt2, "Meta+O": KeyFunMenuOpen, "Shift+Meta+O": KeyFunMenuOpenAlt1, "Alt+Meta+O": KeyFunMenuOpenAlt2, "Meta+S": KeyFunMenuSave, "Shift+Meta+S": KeyFunMenuSaveAs, "Alt+Meta+S": KeyFunMenuSaveAlt, "Shift+Meta+W": KeyFunMenuCloseAlt1, "Alt+Meta+W": KeyFunMenuCloseAlt2, }}, {"MacEmacs", "Mac with emacs-style navigation -- emacs wins in conflicts", KeyMap{ "UpArrow": KeyFunMoveUp, "Shift+UpArrow": KeyFunMoveUp, "Meta+UpArrow": KeyFunMoveUp, "Control+P": KeyFunMoveUp, "Shift+Control+P": KeyFunMoveUp, "Meta+Control+P": KeyFunMoveUp, "DownArrow": KeyFunMoveDown, "Shift+DownArrow": KeyFunMoveDown, "Meta+DownArrow": KeyFunMoveDown, "Control+N": KeyFunMoveDown, "Shift+Control+N": KeyFunMoveDown, "Meta+Control+N": KeyFunMoveDown, "RightArrow": KeyFunMoveRight, "Shift+RightArrow": KeyFunMoveRight, "Meta+RightArrow": KeyFunEnd, "Control+F": KeyFunMoveRight, "Shift+Control+F": KeyFunMoveRight, "Meta+Control+F": KeyFunMoveRight, "LeftArrow": KeyFunMoveLeft, "Shift+LeftArrow": KeyFunMoveLeft, "Meta+LeftArrow": KeyFunHome, "Control+B": KeyFunMoveLeft, "Shift+Control+B": KeyFunMoveLeft, "Meta+Control+B": KeyFunMoveLeft, "PageUp": KeyFunPageUp, "Shift+PageUp": KeyFunPageUp, "Control+UpArrow": KeyFunPageUp, "Control+U": KeyFunPageUp, "PageDown": KeyFunPageDown, "Shift+PageDown": KeyFunPageDown, "Control+DownArrow": KeyFunPageDown, "Shift+Control+V": KeyFunPageDown, "Alt+√": KeyFunPageDown, "Control+V": KeyFunPageDown, "Control+RightArrow": KeyFunWordRight, "Control+LeftArrow": KeyFunWordLeft, "Alt+RightArrow": KeyFunWordRight, "Shift+Alt+RightArrow": KeyFunWordRight, "Alt+LeftArrow": KeyFunWordLeft, "Shift+Alt+LeftArrow": KeyFunWordLeft, "Home": KeyFunHome, "Control+A": KeyFunHome, "Shift+Control+A": KeyFunHome, "End": KeyFunEnd, "Control+E": KeyFunEnd, "Shift+Control+E": KeyFunEnd, "Meta+Home": KeyFunDocHome, "Shift+Home": KeyFunDocHome, "Meta+H": KeyFunDocHome, "Control+H": KeyFunDocHome, "Control+Alt+A": KeyFunDocHome, "Meta+End": KeyFunDocEnd, "Shift+End": KeyFunDocEnd, "Meta+L": KeyFunDocEnd, "Control+Alt+E": KeyFunDocEnd, "Alt+Ƒ": KeyFunWordRight, "Alt+∫": KeyFunWordLeft, "Tab": KeyFunFocusNext, "Shift+Tab": KeyFunFocusPrev, "ReturnEnter": KeyFunEnter, "KeypadEnter": KeyFunEnter, "Meta+A": KeyFunSelectAll, "Control+G": KeyFunCancelSelect, "Control+Spacebar": KeyFunSelectMode, "Control+ReturnEnter": KeyFunAccept, "Escape": KeyFunAbort, "DeleteBackspace": KeyFunBackspace, "Control+DeleteBackspace": KeyFunBackspaceWord, "Alt+DeleteBackspace": KeyFunBackspaceWord, "DeleteForward": KeyFunDelete, "Control+DeleteForward": KeyFunDeleteWord, "Alt+DeleteForward": KeyFunDeleteWord, "Control+D": KeyFunDelete, "Control+K": KeyFunKill, "Alt+∑": KeyFunCopy, "Meta+C": KeyFunCopy, "Control+W": KeyFunCut, "Meta+X": KeyFunCut, "Control+Y": KeyFunPaste, "Meta+V": KeyFunPaste, "Shift+Meta+V": KeyFunPasteHist, "Shift+Control+Y": KeyFunPasteHist, "Alt+∂": KeyFunDuplicate, "Control+T": KeyFunTranspose, "Alt+T": KeyFunTransposeWord, "Control+Z": KeyFunUndo, "Meta+Z": KeyFunUndo, "Control+/": KeyFunUndo, "Shift+Control+Z": KeyFunRedo, "Shift+Meta+Z": KeyFunRedo, "Control+I": KeyFunInsert, "Control+O": KeyFunInsertAfter, "Shift+Meta+=": KeyFunZoomIn, "Meta+=": KeyFunZoomIn, "Meta+-": KeyFunZoomOut, "Control+=": KeyFunZoomIn, "Shift+Control++": KeyFunZoomIn, "Shift+Meta+-": KeyFunZoomOut, "Control+-": KeyFunZoomOut, "Shift+Control+_": KeyFunZoomOut, "Control+Alt+P": KeyFunPrefs, "F5": KeyFunRefresh, "Control+L": KeyFunRecenter, "Control+.": KeyFunComplete, "Control+,": KeyFunLookup, "Control+S": KeyFunSearch, "Meta+F": KeyFunFind, "Meta+R": KeyFunReplace, "Control+R": KeyFunReplace, "Control+J": KeyFunJump, "Control+[": KeyFunHistPrev, "Control+]": KeyFunHistNext, "Meta+[": KeyFunHistPrev, "Meta+]": KeyFunHistNext, "F10": KeyFunMenu, "Meta+`": KeyFunWinFocusNext, "Meta+W": KeyFunWinClose, "Control+Alt+G": KeyFunWinSnapshot, "Shift+Control+G": KeyFunWinSnapshot, "Control+Alt+I": KeyFunGoGiEditor, "Shift+Control+I": KeyFunGoGiEditor, "Meta+N": KeyFunMenuNew, "Shift+Meta+N": KeyFunMenuNewAlt1, "Alt+Meta+N": KeyFunMenuNewAlt2, "Meta+O": KeyFunMenuOpen, "Shift+Meta+O": KeyFunMenuOpenAlt1, "Alt+Meta+O": KeyFunMenuOpenAlt2, "Meta+S": KeyFunMenuSave, "Shift+Meta+S": KeyFunMenuSaveAs, "Alt+Meta+S": KeyFunMenuSaveAlt, "Shift+Meta+W": KeyFunMenuCloseAlt1, "Alt+Meta+W": KeyFunMenuCloseAlt2, }}, {"LinuxEmacs", "Linux with emacs-style navigation -- emacs wins in conflicts", KeyMap{ "UpArrow": KeyFunMoveUp, "Shift+UpArrow": KeyFunMoveUp, "Alt+UpArrow": KeyFunMoveUp, "Control+P": KeyFunMoveUp, "Shift+Control+P": KeyFunMoveUp, "Alt+Control+P": KeyFunMoveUp, "DownArrow": KeyFunMoveDown, "Shift+DownArrow": KeyFunMoveDown, "Alt+DownArrow": KeyFunMoveDown, "Control+N": KeyFunMoveDown, "Shift+Control+N": KeyFunMoveDown, "Alt+Control+N": KeyFunMoveDown, "RightArrow": KeyFunMoveRight, "Shift+RightArrow": KeyFunMoveRight, "Alt+RightArrow": KeyFunEnd, "Control+F": KeyFunMoveRight, "Shift+Control+F": KeyFunMoveRight, "Alt+Control+F": KeyFunMoveRight, "LeftArrow": KeyFunMoveLeft, "Shift+LeftArrow": KeyFunMoveLeft, "Alt+LeftArrow": KeyFunHome, "Control+B": KeyFunMoveLeft, "Shift+Control+B": KeyFunMoveLeft, "Alt+Control+B": KeyFunMoveLeft, "PageUp": KeyFunPageUp, "Shift+PageUp": KeyFunPageUp, "Control+UpArrow": KeyFunPageUp, "Control+U": KeyFunPageUp, "Shift+Control+U": KeyFunPageUp, "Alt+Control+U": KeyFunPageUp, "PageDown": KeyFunPageDown, "Shift+PageDown": KeyFunPageDown, "Control+DownArrow": KeyFunPageDown, "Control+V": KeyFunPageDown, "Shift+Control+V": KeyFunPageDown, "Alt+Control+V": KeyFunPageDown, "Alt+Home": KeyFunDocHome, "Shift+Home": KeyFunDocHome, "Alt+H": KeyFunDocHome, "Control+Alt+A": KeyFunDocHome, "Alt+End": KeyFunDocEnd, "Shift+End": KeyFunDocEnd, "Alt+L": KeyFunDocEnd, "Control+Alt+E": KeyFunDocEnd, "Control+RightArrow": KeyFunWordRight, "Control+LeftArrow": KeyFunWordLeft, "Home": KeyFunHome, "Control+A": KeyFunHome, "Shift+Control+A": KeyFunHome, "End": KeyFunEnd, "Control+E": KeyFunEnd, "Shift+Control+E": KeyFunEnd, "Tab": KeyFunFocusNext, "Shift+Tab": KeyFunFocusPrev, "ReturnEnter": KeyFunEnter, "KeypadEnter": KeyFunEnter, "Alt+A": KeyFunSelectAll, "Control+G": KeyFunCancelSelect, "Control+Spacebar": KeyFunSelectMode, "Control+ReturnEnter": KeyFunAccept, "Escape": KeyFunAbort, "DeleteBackspace": KeyFunBackspace, "Control+DeleteBackspace": KeyFunBackspaceWord, "DeleteForward": KeyFunDelete, "Control+D": KeyFunDelete, "Control+DeleteForward": KeyFunDeleteWord, "Alt+DeleteForward": KeyFunDeleteWord, "Control+K": KeyFunKill, "Alt+W": KeyFunCopy, "Alt+C": KeyFunCopy, "Control+W": KeyFunCut, "Alt+X": KeyFunCut, "Control+Y": KeyFunPaste, "Alt+V": KeyFunPaste, "Shift+Alt+V": KeyFunPasteHist, "Shift+Control+Y": KeyFunPasteHist, "Alt+D": KeyFunDuplicate, "Control+T": KeyFunTranspose, "Alt+T": KeyFunTransposeWord, "Control+Z": KeyFunUndo, "Control+/": KeyFunUndo, "Shift+Control+Z": KeyFunRedo, "Control+I": KeyFunInsert, "Control+O": KeyFunInsertAfter, "Control+=": KeyFunZoomIn, "Shift+Control++": KeyFunZoomIn, "Control+-": KeyFunZoomOut, "Shift+Control+_": KeyFunZoomOut, "Control+Alt+P": KeyFunPrefs, "F5": KeyFunRefresh, "Control+L": KeyFunRecenter, "Control+.": KeyFunComplete, "Control+,": KeyFunLookup, "Control+S": KeyFunSearch, "Alt+F": KeyFunFind, "Control+R": KeyFunReplace, "Control+J": KeyFunJump, "Control+[": KeyFunHistPrev, "Control+]": KeyFunHistNext, "F10": KeyFunMenu, "Alt+F6": KeyFunWinFocusNext, "Shift+Control+W": KeyFunWinClose, "Control+Alt+G": KeyFunWinSnapshot, "Shift+Control+G": KeyFunWinSnapshot, "Control+Alt+I": KeyFunGoGiEditor, "Shift+Control+I": KeyFunGoGiEditor, "Alt+N": KeyFunMenuNew, "Shift+Alt+N": KeyFunMenuNewAlt1, "Control+Alt+N": KeyFunMenuNewAlt2, "Alt+O": KeyFunMenuOpen, "Shift+Alt+O": KeyFunMenuOpenAlt1, "Control+Alt+O": KeyFunMenuOpenAlt2, "Alt+S": KeyFunMenuSave, "Shift+Alt+S": KeyFunMenuSaveAs, "Control+Alt+S": KeyFunMenuSaveAlt, "Shift+Alt+W": KeyFunMenuCloseAlt1, "Control+Alt+W": KeyFunMenuCloseAlt2, }}, {"LinuxStd", "Standard Linux KeyMap", KeyMap{ "UpArrow": KeyFunMoveUp, "Shift+UpArrow": KeyFunMoveUp, "DownArrow": KeyFunMoveDown, "Shift+DownArrow": KeyFunMoveDown, "RightArrow": KeyFunMoveRight, "Shift+RightArrow": KeyFunMoveRight, "LeftArrow": KeyFunMoveLeft, "Shift+LeftArrow": KeyFunMoveLeft, "PageUp": KeyFunPageUp, "Shift+PageUp": KeyFunPageUp, "Control+UpArrow": KeyFunPageUp, "PageDown": KeyFunPageDown, "Shift+PageDown": KeyFunPageDown, "Control+DownArrow": KeyFunPageDown, "Home": KeyFunHome, "Alt+LeftArrow": KeyFunHome, "End": KeyFunEnd, "Alt+Home": KeyFunDocHome, "Shift+Home": KeyFunDocHome, "Alt+End": KeyFunDocEnd, "Shift+End": KeyFunDocEnd, "Control+RightArrow": KeyFunWordRight, "Control+LeftArrow": KeyFunWordLeft, "Alt+RightArrow": KeyFunEnd, "Tab": KeyFunFocusNext, "Shift+Tab": KeyFunFocusPrev, "ReturnEnter": KeyFunEnter, "KeypadEnter": KeyFunEnter, "Control+A": KeyFunSelectAll, "Shift+Control+A": KeyFunCancelSelect, "Control+G": KeyFunCancelSelect, "Control+Spacebar": KeyFunSelectMode, "Control+ReturnEnter": KeyFunAccept, "Escape": KeyFunAbort, "DeleteBackspace": KeyFunBackspace, "Control+DeleteBackspace": KeyFunBackspaceWord, "DeleteForward": KeyFunDelete, "Control+DeleteForward": KeyFunDeleteWord, "Alt+DeleteForward": KeyFunDeleteWord, "Control+K": KeyFunKill, "Control+C": KeyFunCopy, "Control+X": KeyFunCut, "Control+V": KeyFunPaste, "Shift+Control+V": KeyFunPasteHist, "Alt+D": KeyFunDuplicate, "Control+T": KeyFunTranspose, "Alt+T": KeyFunTransposeWord, "Control+Z": KeyFunUndo, "Control+Y": KeyFunRedo, "Shift+Control+Z": KeyFunRedo, "Control+Alt+I": KeyFunInsert, "Control+Alt+O": KeyFunInsertAfter, "Control+=": KeyFunZoomIn, "Shift+Control++": KeyFunZoomIn, "Control+-": KeyFunZoomOut, "Shift+Control+_": KeyFunZoomOut, "Shift+Control+P": KeyFunPrefs, "Control+Alt+P": KeyFunPrefs, "F5": KeyFunRefresh, "Control+L": KeyFunRecenter, "Control+.": KeyFunComplete, "Control+,": KeyFunLookup, "Alt+S": KeyFunSearch, "Control+F": KeyFunFind, "Control+H": KeyFunReplace, "Control+R": KeyFunReplace, "Control+J": KeyFunJump, "Control+[": KeyFunHistPrev, "Control+]": KeyFunHistNext, "Control+N": KeyFunMenuNew, "F10": KeyFunMenu, "Alt+F6": KeyFunWinFocusNext, "Control+W": KeyFunWinClose, "Control+Alt+G": KeyFunWinSnapshot, "Shift+Control+G": KeyFunWinSnapshot, "Shift+Control+I": KeyFunGoGiEditor, "Shift+Control+N": KeyFunMenuNewAlt1, "Control+Alt+N": KeyFunMenuNewAlt2, "Control+O": KeyFunMenuOpen, "Shift+Control+O": KeyFunMenuOpenAlt1, "Shift+Alt+O": KeyFunMenuOpenAlt2, "Control+S": KeyFunMenuSave, "Shift+Control+S": KeyFunMenuSaveAs, "Control+Alt+S": KeyFunMenuSaveAlt, "Shift+Control+W": KeyFunMenuCloseAlt1, "Control+Alt+W": KeyFunMenuCloseAlt2, }}, {"WindowsStd", "Standard Windows KeyMap", KeyMap{ "UpArrow": KeyFunMoveUp, "Shift+UpArrow": KeyFunMoveUp, "DownArrow": KeyFunMoveDown, "Shift+DownArrow": KeyFunMoveDown, "RightArrow": KeyFunMoveRight, "Shift+RightArrow": KeyFunMoveRight, "LeftArrow": KeyFunMoveLeft, "Shift+LeftArrow": KeyFunMoveLeft, "PageUp": KeyFunPageUp, "Shift+PageUp": KeyFunPageUp, "Control+UpArrow": KeyFunPageUp, "PageDown": KeyFunPageDown, "Shift+PageDown": KeyFunPageDown, "Control+DownArrow": KeyFunPageDown, "Home": KeyFunHome, "Alt+LeftArrow": KeyFunHome, "End": KeyFunEnd, "Alt+RightArrow": KeyFunEnd, "Alt+Home": KeyFunDocHome, "Shift+Home": KeyFunDocHome, "Alt+End": KeyFunDocEnd, "Shift+End": KeyFunDocEnd, "Control+RightArrow": KeyFunWordRight, "Control+LeftArrow": KeyFunWordLeft, "Tab": KeyFunFocusNext, "Shift+Tab": KeyFunFocusPrev, "ReturnEnter": KeyFunEnter, "KeypadEnter": KeyFunEnter, "Control+A": KeyFunSelectAll, "Shift+Control+A": KeyFunCancelSelect, "Control+G": KeyFunCancelSelect, "Control+Spacebar": KeyFunSelectMode, "Control+ReturnEnter": KeyFunAccept, "Escape": KeyFunAbort, "DeleteBackspace": KeyFunBackspace, "Control+DeleteBackspace": KeyFunBackspaceWord, "DeleteForward": KeyFunDelete, "Control+DeleteForward": KeyFunDeleteWord, "Alt+DeleteForward": KeyFunDeleteWord, "Control+K": KeyFunKill, "Control+C": KeyFunCopy, "Control+X": KeyFunCut, "Control+V": KeyFunPaste, "Shift+Control+V": KeyFunPasteHist, "Alt+D": KeyFunDuplicate, "Control+T": KeyFunTranspose, "Alt+T": KeyFunTransposeWord, "Control+Z": KeyFunUndo, "Control+Y": KeyFunRedo, "Shift+Control+Z": KeyFunRedo, "Control+Alt+I": KeyFunInsert, "Control+Alt+O": KeyFunInsertAfter, "Control+=": KeyFunZoomIn, "Shift+Control++": KeyFunZoomIn, "Control+-": KeyFunZoomOut, "Shift+Control+_": KeyFunZoomOut, "Shift+Control+P": KeyFunPrefs, "Control+Alt+P": KeyFunPrefs, "F5": KeyFunRefresh, "Control+L": KeyFunRecenter, "Control+.": KeyFunComplete, "Control+,": KeyFunLookup, "Alt+S": KeyFunSearch, "Control+F": KeyFunFind, "Control+H": KeyFunReplace, "Control+R": KeyFunReplace, "Control+J": KeyFunJump, "Control+[": KeyFunHistPrev, "Control+]": KeyFunHistNext, "F10": KeyFunMenu, "Alt+F6": KeyFunWinFocusNext, "Control+W": KeyFunWinClose, "Control+Alt+G": KeyFunWinSnapshot, "Shift+Control+G": KeyFunWinSnapshot, "Shift+Control+I": KeyFunGoGiEditor, "Control+N": KeyFunMenuNew, "Shift+Control+N": KeyFunMenuNewAlt1, "Control+Alt+N": KeyFunMenuNewAlt2, "Control+O": KeyFunMenuOpen, "Shift+Control+O": KeyFunMenuOpenAlt1, "Shift+Alt+O": KeyFunMenuOpenAlt2, "Control+S": KeyFunMenuSave, "Shift+Control+S": KeyFunMenuSaveAs, "Control+Alt+S": KeyFunMenuSaveAlt, "Shift+Control+W": KeyFunMenuCloseAlt1, "Control+Alt+W": KeyFunMenuCloseAlt2, }}, {"ChromeStd", "Standard chrome-browser and linux-under-chrome bindings", KeyMap{ "UpArrow": KeyFunMoveUp, "Shift+UpArrow": KeyFunMoveUp, "DownArrow": KeyFunMoveDown, "Shift+DownArrow": KeyFunMoveDown, "RightArrow": KeyFunMoveRight, "Shift+RightArrow": KeyFunMoveRight, "LeftArrow": KeyFunMoveLeft, "Shift+LeftArrow": KeyFunMoveLeft, "PageUp": KeyFunPageUp, "Shift+PageUp": KeyFunPageUp, "Control+UpArrow": KeyFunPageUp, "PageDown": KeyFunPageDown, "Shift+PageDown": KeyFunPageDown, "Control+DownArrow": KeyFunPageDown, "Home": KeyFunHome, "Alt+LeftArrow": KeyFunHome, "End": KeyFunEnd, "Alt+Home": KeyFunDocHome, "Shift+Home": KeyFunDocHome, "Alt+End": KeyFunDocEnd, "Shift+End": KeyFunDocEnd, "Control+RightArrow": KeyFunWordRight, "Control+LeftArrow": KeyFunWordLeft, "Alt+RightArrow": KeyFunEnd, "Tab": KeyFunFocusNext, "Shift+Tab": KeyFunFocusPrev, "ReturnEnter": KeyFunEnter, "KeypadEnter": KeyFunEnter, "Control+A": KeyFunSelectAll, "Shift+Control+A": KeyFunCancelSelect, "Control+G": KeyFunCancelSelect, "Control+Spacebar": KeyFunSelectMode, "Control+ReturnEnter": KeyFunAccept, "Escape": KeyFunAbort, "DeleteBackspace": KeyFunBackspace, "Control+DeleteBackspace": KeyFunBackspaceWord, "DeleteForward": KeyFunDelete, "Control+DeleteForward": KeyFunDeleteWord, "Alt+DeleteForward": KeyFunDeleteWord, "Control+K": KeyFunKill, "Control+C": KeyFunCopy, "Control+X": KeyFunCut, "Control+V": KeyFunPaste, "Shift+Control+V": KeyFunPasteHist, "Alt+D": KeyFunDuplicate, "Control+T": KeyFunTranspose, "Alt+T": KeyFunTransposeWord, "Control+Z": KeyFunUndo, "Control+Y": KeyFunRedo, "Shift+Control+Z": KeyFunRedo, "Control+Alt+I": KeyFunInsert, "Control+Alt+O": KeyFunInsertAfter, "Control+=": KeyFunZoomIn, "Shift+Control++": KeyFunZoomIn, "Control+-": KeyFunZoomOut, "Shift+Control+_": KeyFunZoomOut, "Shift+Control+P": KeyFunPrefs, "Control+Alt+P": KeyFunPrefs, "F5": KeyFunRefresh, "Control+L": KeyFunRecenter, "Control+.": KeyFunComplete, "Control+,": KeyFunLookup, "Alt+S": KeyFunSearch, "Control+F": KeyFunFind, "Control+H": KeyFunReplace, "Control+R": KeyFunReplace, "Control+J": KeyFunJump, "Control+[": KeyFunHistPrev, "Control+]": KeyFunHistNext, "F10": KeyFunMenu, "Alt+F6": KeyFunWinFocusNext, "Control+W": KeyFunWinClose, "Control+Alt+G": KeyFunWinSnapshot, "Shift+Control+G": KeyFunWinSnapshot, "Shift+Control+I": KeyFunGoGiEditor, "Control+N": KeyFunMenuNew, "Shift+Control+N": KeyFunMenuNewAlt1, "Control+Alt+N": KeyFunMenuNewAlt2, "Control+O": KeyFunMenuOpen, "Shift+Control+O": KeyFunMenuOpenAlt1, "Shift+Alt+O": KeyFunMenuOpenAlt2, "Control+S": KeyFunMenuSave, "Shift+Control+S": KeyFunMenuSaveAs, "Control+Alt+S": KeyFunMenuSaveAlt, "Shift+Control+W": KeyFunMenuCloseAlt1, "Control+Alt+W": KeyFunMenuCloseAlt2, }}, }
StdKeyMaps is the original compiled-in set of standard keymaps that have the lastest key functions bound to standard key chords.
var StretchProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "max-width": -1.0, "max-height": -1.0, }
var StyleBorderFuncs = map[string]StyleFunc{ "border-style": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { bs := obj.(*BorderStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { bs.Style = par.(*BorderStyle).Style } else if init { bs.Style = BorderSolid } return } switch vt := val.(type) { case string: kit.Enums.SetAnyEnumIfaceFromString(&bs.Style, vt) case BorderDrawStyle: bs.Style = vt default: if iv, ok := kit.ToInt(val); ok { bs.Style = BorderDrawStyle(iv) } else { StyleSetError(key, val) } } }, "border-width": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { bs := obj.(*BorderStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { bs.Width = par.(*BorderStyle).Width } else if init { bs.Width.Val = 0 } return } bs.Width.SetIFace(val, key) }, "border-radius": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { bs := obj.(*BorderStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { bs.Radius = par.(*BorderStyle).Radius } else if init { bs.Radius.Val = 0 } return } bs.Radius.SetIFace(val, key) }, "border-color": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { bs := obj.(*BorderStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { bs.Color = par.(*BorderStyle).Color } else if init { bs.Color.SetColor(color.Black) } return } bs.Color.SetIFace(val, vp, key) }, }
StyleBorderFuncs are functions for styling the BorderStyle object
var StyleFillFuncs = map[string]StyleFunc{ "fill": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { fs := obj.(*FillStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { fs.Color = par.(*FillStyle).Color } else if init { fs.Color.SetColor(color.Black) } return } fs.Color.SetIFace(val, vp, key) }, "fill-opacity": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { fs := obj.(*FillStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { fs.Opacity = par.(*FillStyle).Opacity } else if init { fs.Opacity = 1 } return } if iv, ok := kit.ToFloat32(val); ok { fs.Opacity = iv } }, "fill-rule": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { fs := obj.(*FillStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { fs.Rule = par.(*FillStyle).Rule } else if init { fs.Rule = FillRuleNonZero } return } switch vt := val.(type) { case string: fs.Rule.FromString(vt) case FillRules: fs.Rule = vt default: if iv, ok := kit.ToInt(val); ok { fs.Rule = FillRules(iv) } else { StyleSetError(key, val) } } }, }
StyleFillFuncs are functions for styling the FillStyle object
var StyleFontFuncs = map[string]StyleFunc{ "color": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { fs := obj.(*FontStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { fs.Color = par.(*FontStyle).Color } else if init { fs.Color.SetColor(color.Black) } return } fs.Color.SetIFace(val, vp, key) }, "background-color": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { fs := obj.(*FontStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { fs.BgColor = par.(*FontStyle).BgColor } else if init { fs.BgColor = ColorSpec{} } return } fs.BgColor.SetIFace(val, vp, key) }, "opacity": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { fs := obj.(*FontStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { fs.Opacity = par.(*FontStyle).Opacity } else if init { fs.Opacity = 1 } return } if iv, ok := kit.ToFloat32(val); ok { fs.Opacity = iv } }, "font-size": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { fs := obj.(*FontStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { fs.Size = par.(*FontStyle).Size } else if init { fs.Size.Set(12, units.Pt) } return } switch vt := val.(type) { case string: if psz, ok := FontSizePoints[vt]; ok { fs.Size = units.NewPt(psz) } else { fs.Size.SetIFace(val, key) } default: fs.Size.SetIFace(val, key) } }, "font-family": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { fs := obj.(*FontStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { fs.Family = par.(*FontStyle).Family } else if init { fs.Family = "" } return } fs.Family = kit.ToString(val) }, "font-style": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { fs := obj.(*FontStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { fs.Style = par.(*FontStyle).Style } else if init { fs.Style = FontNormal } return } switch vt := val.(type) { case string: kit.Enums.SetAnyEnumIfaceFromString(&fs.Style, vt) case FontStyles: fs.Style = vt default: if iv, ok := kit.ToInt(val); ok { fs.Style = FontStyles(iv) } else { StyleSetError(key, val) } } }, "font-weight": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { fs := obj.(*FontStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { fs.Weight = par.(*FontStyle).Weight } else if init { fs.Weight = WeightNormal } return } switch vt := val.(type) { case string: kit.Enums.SetAnyEnumIfaceFromString(&fs.Weight, vt) case FontWeights: fs.Weight = vt default: if iv, ok := kit.ToInt(val); ok { fs.Weight = FontWeights(iv) } else { StyleSetError(key, val) } } }, "font-stretch": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { fs := obj.(*FontStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { fs.Stretch = par.(*FontStyle).Stretch } else if init { fs.Stretch = FontStrNormal } return } switch vt := val.(type) { case string: kit.Enums.SetAnyEnumIfaceFromString(&fs.Stretch, vt) case FontStretch: fs.Stretch = vt default: if iv, ok := kit.ToInt(val); ok { fs.Stretch = FontStretch(iv) } else { StyleSetError(key, val) } } }, "font-variant": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { fs := obj.(*FontStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { fs.Variant = par.(*FontStyle).Variant } else if init { fs.Variant = FontVarNormal } return } switch vt := val.(type) { case string: kit.Enums.SetAnyEnumIfaceFromString(&fs.Variant, vt) case FontVariants: fs.Variant = vt default: if iv, ok := kit.ToInt(val); ok { fs.Variant = FontVariants(iv) } else { StyleSetError(key, val) } } }, "text-decoration": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { fs := obj.(*FontStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { fs.Deco = par.(*FontStyle).Deco } else if init { fs.Deco = DecoNone } return } switch vt := val.(type) { case string: if vt == "none" { fs.Deco = DecoNone } else { kit.Enums.SetAnyEnumIfaceFromString(&fs.Deco, vt) } case TextDecorations: fs.Deco = vt default: if iv, ok := kit.ToInt(val); ok { fs.Deco = TextDecorations(iv) } else { StyleSetError(key, val) } } }, "baseline-shift": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { fs := obj.(*FontStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { fs.Shift = par.(*FontStyle).Shift } else if init { fs.Shift = ShiftBaseline } return } switch vt := val.(type) { case string: kit.Enums.SetAnyEnumIfaceFromString(&fs.Shift, vt) case BaselineShifts: fs.Shift = vt default: if iv, ok := kit.ToInt(val); ok { fs.Shift = BaselineShifts(iv) } else { StyleSetError(key, val) } } }, }
StyleFontFuncs are functions for styling the FontStyle object
var StyleLayoutFuncs = map[string]StyleFunc{ "z-index": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ly := obj.(*LayoutStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ly.ZIndex = par.(*LayoutStyle).ZIndex } else if init { ly.ZIndex = 0 } return } if iv, ok := kit.ToInt(val); ok { ly.ZIndex = int(iv) } }, "horizontal-align": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ly := obj.(*LayoutStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ly.AlignH = par.(*LayoutStyle).AlignH } else if init { ly.AlignH = AlignLeft } return } switch vt := val.(type) { case string: kit.Enums.SetAnyEnumIfaceFromString(&ly.AlignH, vt) case Align: ly.AlignH = vt default: if iv, ok := kit.ToInt(val); ok { ly.AlignH = Align(iv) } else { StyleSetError(key, val) } } }, "vertical-align": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ly := obj.(*LayoutStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ly.AlignV = par.(*LayoutStyle).AlignV } else if init { ly.AlignV = AlignMiddle } return } switch vt := val.(type) { case string: kit.Enums.SetAnyEnumIfaceFromString(&ly.AlignV, vt) case Align: ly.AlignV = vt default: if iv, ok := kit.ToInt(val); ok { ly.AlignV = Align(iv) } else { StyleSetError(key, val) } } }, "x": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ly := obj.(*LayoutStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ly.PosX = par.(*LayoutStyle).PosX } else if init { ly.PosX.Val = 0 } return } ly.PosX.SetIFace(val, key) }, "y": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ly := obj.(*LayoutStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ly.PosY = par.(*LayoutStyle).PosY } else if init { ly.PosY.Val = 0 } return } ly.PosY.SetIFace(val, key) }, "width": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ly := obj.(*LayoutStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ly.Width = par.(*LayoutStyle).Width } else if init { ly.Width.Val = 0 } return } ly.Width.SetIFace(val, key) }, "height": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ly := obj.(*LayoutStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ly.Height = par.(*LayoutStyle).Height } else if init { ly.Height.Val = 0 } return } ly.Height.SetIFace(val, key) }, "max-width": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ly := obj.(*LayoutStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ly.MaxWidth = par.(*LayoutStyle).MaxWidth } else if init { ly.MaxWidth.Val = 0 } return } ly.MaxWidth.SetIFace(val, key) }, "max-height": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ly := obj.(*LayoutStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ly.MaxHeight = par.(*LayoutStyle).MaxHeight } else if init { ly.MaxHeight.Val = 0 } return } ly.MaxHeight.SetIFace(val, key) }, "min-width": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ly := obj.(*LayoutStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ly.MinWidth = par.(*LayoutStyle).MinWidth } else if init { ly.MinWidth.Set(2, units.Px) } return } ly.MinWidth.SetIFace(val, key) }, "min-height": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ly := obj.(*LayoutStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ly.MinHeight = par.(*LayoutStyle).MinHeight } else if init { ly.MinHeight.Set(2, units.Px) } return } ly.MinHeight.SetIFace(val, key) }, "margin": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ly := obj.(*LayoutStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ly.Margin = par.(*LayoutStyle).Margin } else if init { ly.Margin.Val = 0 } return } ly.Margin.SetIFace(val, key) }, "padding": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ly := obj.(*LayoutStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ly.Padding = par.(*LayoutStyle).Padding } else if init { ly.Padding.Val = 0 } return } ly.Padding.SetIFace(val, key) }, "overflow": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ly := obj.(*LayoutStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ly.Overflow = par.(*LayoutStyle).Overflow } else if init { ly.Overflow = OverflowAuto } return } switch vt := val.(type) { case string: kit.Enums.SetAnyEnumIfaceFromString(&ly.Overflow, vt) case Overflow: ly.Overflow = vt default: if iv, ok := kit.ToInt(val); ok { ly.Overflow = Overflow(iv) } else { StyleSetError(key, val) } } }, "columns": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ly := obj.(*LayoutStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ly.Columns = par.(*LayoutStyle).Columns } else if init { ly.Columns = 0 } return } if iv, ok := kit.ToInt(val); ok { ly.Columns = int(iv) } }, "row": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ly := obj.(*LayoutStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ly.Row = par.(*LayoutStyle).Row } else if init { ly.Row = 0 } return } if iv, ok := kit.ToInt(val); ok { ly.Row = int(iv) } }, "col": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ly := obj.(*LayoutStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ly.Col = par.(*LayoutStyle).Col } else if init { ly.Col = 0 } return } if iv, ok := kit.ToInt(val); ok { ly.Col = int(iv) } }, "row-span": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ly := obj.(*LayoutStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ly.RowSpan = par.(*LayoutStyle).RowSpan } else if init { ly.RowSpan = 0 } return } if iv, ok := kit.ToInt(val); ok { ly.RowSpan = int(iv) } }, "col-span": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ly := obj.(*LayoutStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ly.ColSpan = par.(*LayoutStyle).ColSpan } else if init { ly.ColSpan = 0 } return } if iv, ok := kit.ToInt(val); ok { ly.ColSpan = int(iv) } }, "scrollbar-width": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ly := obj.(*LayoutStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ly.ScrollBarWidth = par.(*LayoutStyle).ScrollBarWidth } else if init { ly.ScrollBarWidth.Val = 0 } return } ly.ScrollBarWidth.SetIFace(val, key) }, }
StyleLayoutFuncs are functions for styling the LayoutStyle object
var StyleOutlineFuncs = map[string]StyleFunc{ "outline-style": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { bs := obj.(*BorderStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { bs.Style = par.(*BorderStyle).Style } else if init { bs.Style = BorderNone } return } switch vt := val.(type) { case string: kit.Enums.SetAnyEnumIfaceFromString(&bs.Style, vt) case BorderDrawStyle: bs.Style = vt default: if iv, ok := kit.ToInt(val); ok { bs.Style = BorderDrawStyle(iv) } else { StyleSetError(key, val) } } }, "outline-width": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { bs := obj.(*BorderStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { bs.Width = par.(*BorderStyle).Width } else if init { bs.Width.Val = 0 } return } bs.Width.SetIFace(val, key) }, "outline-radius": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { bs := obj.(*BorderStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { bs.Radius = par.(*BorderStyle).Radius } else if init { bs.Radius.Val = 0 } return } bs.Radius.SetIFace(val, key) }, "outline-color": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { bs := obj.(*BorderStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { bs.Color = par.(*BorderStyle).Color } else if init { bs.Color.SetColor(color.Black) } return } bs.Color.SetIFace(val, vp, key) }, }
StyleOutlineFuncs are functions for styling the OutlineStyle object
var StylePaintFuncs = map[string]StyleFunc{ "vector-effect": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { pc := obj.(*Paint) if inh, init := StyleInhInit(val, par); inh || init { if inh { pc.VecEff = par.(*Paint).VecEff } else if init { pc.VecEff = VecEffNone } return } switch vt := val.(type) { case string: pc.VecEff.FromString(vt) case VectorEffects: pc.VecEff = vt default: if iv, ok := kit.ToInt(val); ok { pc.VecEff = VectorEffects(iv) } else { StyleSetError(key, val) } } }, "transform": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { pc := obj.(*Paint) if inh, init := StyleInhInit(val, par); inh || init { if inh { pc.XForm = par.(*Paint).XForm } else if init { pc.XForm = mat32.Identity2D() } return } switch vt := val.(type) { case string: pc.XForm.SetString(vt) case *mat32.Mat2: pc.XForm = *vt case mat32.Mat2: pc.XForm = vt } }, }
StylePaintFuncs are functions for styling the StrokeStyle object
var StylePropProps = ki.Props{ "style-prop": true, }
StylePropProps should be set as type props for any enum (not struct types, which must have their own props) that is useful as a styling property -- use this for selecting types to add to Props
var StyleShadowFuncs = map[string]StyleFunc{ "box-shadow.h-offset": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ss := obj.(*ShadowStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ss.HOffset = par.(*ShadowStyle).HOffset } else if init { ss.HOffset.Val = 0 } return } ss.HOffset.SetIFace(val, key) }, "box-shadow.v-offset": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ss := obj.(*ShadowStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ss.VOffset = par.(*ShadowStyle).VOffset } else if init { ss.VOffset.Val = 0 } return } ss.VOffset.SetIFace(val, key) }, "box-shadow.blur": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ss := obj.(*ShadowStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ss.Blur = par.(*ShadowStyle).Blur } else if init { ss.Blur.Val = 0 } return } ss.Blur.SetIFace(val, key) }, "box-shadow.spread": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ss := obj.(*ShadowStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ss.Spread = par.(*ShadowStyle).Spread } else if init { ss.Spread.Val = 0 } return } ss.Spread.SetIFace(val, key) }, "box-shadow.color": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ss := obj.(*ShadowStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ss.Color = par.(*ShadowStyle).Color } else if init { ss.Color.SetColor(color.Black) } return } ss.Color.SetIFace(val, vp, key) }, "box-shadow.inset": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ss := obj.(*ShadowStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ss.Inset = par.(*ShadowStyle).Inset } else if init { ss.Inset = false } return } if bv, ok := kit.ToBool(val); ok { ss.Inset = bv } }, }
StyleShadowFuncs are functions for styling the ShadowStyle object
var StyleStrokeFuncs = map[string]StyleFunc{ "stroke": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { fs := obj.(*StrokeStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { fs.Color = par.(*StrokeStyle).Color } else if init { fs.Color.SetColor(color.Black) } return } fs.Color.SetIFace(val, vp, key) }, "stroke-opacity": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { fs := obj.(*StrokeStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { fs.Opacity = par.(*StrokeStyle).Opacity } else if init { fs.Opacity = 1 } return } if iv, ok := kit.ToFloat32(val); ok { fs.Opacity = iv } }, "stroke-width": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { fs := obj.(*StrokeStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { fs.Width = par.(*StrokeStyle).Width } else if init { fs.Width.Set(1, units.Px) } return } fs.Width.SetIFace(val, key) }, "stroke-min-width": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { fs := obj.(*StrokeStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { fs.MinWidth = par.(*StrokeStyle).MinWidth } else if init { fs.MinWidth.Set(1, units.Px) } return } fs.MinWidth.SetIFace(val, key) }, "stroke-dashes": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { fs := obj.(*StrokeStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { fs.Dashes = par.(*StrokeStyle).Dashes } else if init { fs.Dashes = nil } return } switch vt := val.(type) { case string: fs.Dashes = ParseDashesString(vt) case []float64: mat32.CopyFloat64s(&fs.Dashes, vt) case *[]float64: mat32.CopyFloat64s(&fs.Dashes, *vt) } }, "stroke-linecap": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { fs := obj.(*StrokeStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { fs.Cap = par.(*StrokeStyle).Cap } else if init { fs.Cap = LineCapButt } return } switch vt := val.(type) { case string: fs.Cap.FromString(vt) case LineCaps: fs.Cap = vt default: if iv, ok := kit.ToInt(val); ok { fs.Cap = LineCaps(iv) } else { StyleSetError(key, val) } } }, "stroke-linejoin": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { fs := obj.(*StrokeStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { fs.Join = par.(*StrokeStyle).Join } else if init { fs.Join = LineJoinMiter } return } switch vt := val.(type) { case string: fs.Join.FromString(vt) case LineJoins: fs.Join = vt default: if iv, ok := kit.ToInt(val); ok { fs.Join = LineJoins(iv) } else { StyleSetError(key, val) } } }, "stroke-miterlimit": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { fs := obj.(*StrokeStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { fs.MiterLimit = par.(*StrokeStyle).MiterLimit } else if init { fs.MiterLimit = 1 } return } if iv, ok := kit.ToFloat32(val); ok { fs.MiterLimit = iv } }, }
StyleStrokeFuncs are functions for styling the StrokeStyle object
var StyleStyleFuncs = map[string]StyleFunc{ "display": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { s := obj.(*Style) if inh, init := StyleInhInit(val, par); inh || init { if inh { s.Display = par.(*Style).Display } else if init { s.Display = true } return } if bv, ok := kit.ToBool(val); ok { s.Display = bv } }, "visible": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { s := obj.(*Style) if inh, init := StyleInhInit(val, par); inh || init { if inh { s.Visible = par.(*Style).Visible } else if init { s.Visible = false } return } if bv, ok := kit.ToBool(val); ok { s.Visible = bv } }, "inactive": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { s := obj.(*Style) if inh, init := StyleInhInit(val, par); inh || init { if inh { s.Inactive = par.(*Style).Inactive } else if init { s.Inactive = false } return } if bv, ok := kit.ToBool(val); ok { s.Inactive = bv } }, "pointer-events": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { s := obj.(*Style) if inh, init := StyleInhInit(val, par); inh || init { if inh { s.PointerEvents = par.(*Style).PointerEvents } else if init { s.PointerEvents = true } return } if bv, ok := kit.ToBool(val); ok { s.PointerEvents = bv } }, }
StyleStyleFuncs are functions for styling the Style object itself
var StyleTextFuncs = map[string]StyleFunc{ "text-align": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ts := obj.(*TextStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ts.Align = par.(*TextStyle).Align } else if init { ts.Align = AlignLeft } return } switch vt := val.(type) { case string: kit.Enums.SetAnyEnumIfaceFromString(&ts.Align, vt) case Align: ts.Align = vt default: if iv, ok := kit.ToInt(val); ok { ts.Align = Align(iv) } else { StyleSetError(key, val) } } }, "text-anchor": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ts := obj.(*TextStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ts.Anchor = par.(*TextStyle).Anchor } else if init { ts.Anchor = AnchorStart } return } switch vt := val.(type) { case string: kit.Enums.SetAnyEnumIfaceFromString(&ts.Anchor, vt) case TextAnchors: ts.Anchor = vt default: if iv, ok := kit.ToInt(val); ok { ts.Anchor = TextAnchors(iv) } else { StyleSetError(key, val) } } }, "letter-spacing": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ts := obj.(*TextStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ts.LetterSpacing = par.(*TextStyle).LetterSpacing } else if init { ts.LetterSpacing.Val = 0 } return } ts.LetterSpacing.SetIFace(val, key) }, "word-spacing": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ts := obj.(*TextStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ts.WordSpacing = par.(*TextStyle).WordSpacing } else if init { ts.WordSpacing.Val = 0 } return } ts.WordSpacing.SetIFace(val, key) }, "line-height": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ts := obj.(*TextStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ts.LineHeight = par.(*TextStyle).LineHeight } else if init { ts.LineHeight = 1 } return } if iv, ok := kit.ToFloat32(val); ok { ts.LineHeight = iv } }, "white-space": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ts := obj.(*TextStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ts.WhiteSpace = par.(*TextStyle).WhiteSpace } else if init { ts.WhiteSpace = WhiteSpaceNormal } return } switch vt := val.(type) { case string: kit.Enums.SetAnyEnumIfaceFromString(&ts.WhiteSpace, vt) case WhiteSpaces: ts.WhiteSpace = vt default: if iv, ok := kit.ToInt(val); ok { ts.WhiteSpace = WhiteSpaces(iv) } else { StyleSetError(key, val) } } }, "unicode-bidi": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ts := obj.(*TextStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ts.UnicodeBidi = par.(*TextStyle).UnicodeBidi } else if init { ts.UnicodeBidi = BidiNormal } return } switch vt := val.(type) { case string: kit.Enums.SetAnyEnumIfaceFromString(&ts.UnicodeBidi, vt) case UnicodeBidi: ts.UnicodeBidi = vt default: if iv, ok := kit.ToInt(val); ok { ts.UnicodeBidi = UnicodeBidi(iv) } else { StyleSetError(key, val) } } }, "direction": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ts := obj.(*TextStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ts.Direction = par.(*TextStyle).Direction } else if init { ts.Direction = LRTB } return } switch vt := val.(type) { case string: kit.Enums.SetAnyEnumIfaceFromString(&ts.Direction, vt) case TextDirections: ts.Direction = vt default: if iv, ok := kit.ToInt(val); ok { ts.Direction = TextDirections(iv) } else { StyleSetError(key, val) } } }, "writing-mode": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ts := obj.(*TextStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ts.WritingMode = par.(*TextStyle).WritingMode } else if init { ts.WritingMode = LRTB } return } switch vt := val.(type) { case string: kit.Enums.SetAnyEnumIfaceFromString(&ts.WritingMode, vt) case TextDirections: ts.WritingMode = vt default: if iv, ok := kit.ToInt(val); ok { ts.WritingMode = TextDirections(iv) } else { StyleSetError(key, val) } } }, "glyph-orientation-vertical": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ts := obj.(*TextStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ts.OrientationVert = par.(*TextStyle).OrientationVert } else if init { ts.OrientationVert = 1 } return } if iv, ok := kit.ToFloat32(val); ok { ts.OrientationVert = iv } }, "glyph-orientation-horizontal": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ts := obj.(*TextStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ts.OrientationHoriz = par.(*TextStyle).OrientationHoriz } else if init { ts.OrientationHoriz = 1 } return } if iv, ok := kit.ToFloat32(val); ok { ts.OrientationHoriz = iv } }, "text-indent": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ts := obj.(*TextStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ts.Indent = par.(*TextStyle).Indent } else if init { ts.Indent.Val = 0 } return } ts.Indent.SetIFace(val, key) }, "para-spacing": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ts := obj.(*TextStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ts.ParaSpacing = par.(*TextStyle).ParaSpacing } else if init { ts.ParaSpacing.Val = 0 } return } ts.ParaSpacing.SetIFace(val, key) }, "tab-size": func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D) { ts := obj.(*TextStyle) if inh, init := StyleInhInit(val, par); inh || init { if inh { ts.TabSize = par.(*TextStyle).TabSize } else if init { ts.TabSize = 4 } return } if iv, ok := kit.ToInt(val); ok { ts.TabSize = int(iv) } }, }
StyleTextFuncs are functions for styling the TextStyle object
var TabButtonMinWidth = float32(8)
TabButtonMinWidth is the minimum width of the tab button, in Ch units
var TabButtonProps = ki.Props{ "EnumType:Flag": KiT_ButtonFlags, "min-width": units.NewCh(TabButtonMinWidth), "min-height": units.NewEm(1.6), "border-width": units.NewPx(0), "border-radius": units.NewPx(0), "border-color": &Prefs.Colors.Border, "text-align": AlignCenter, "background-color": &Prefs.Colors.Control, "color": &Prefs.Colors.Font, "padding": units.NewPx(4), "margin": units.NewPx(0), "indicator": "close", "#icon": ki.Props{ "width": units.NewEm(1), "height": units.NewEm(1), "margin": units.NewPx(0), "padding": units.NewPx(0), "fill": &Prefs.Colors.Icon, "stroke": &Prefs.Colors.Font, }, "#label": ki.Props{ "margin": units.NewPx(0), "padding": units.NewPx(0), }, "#close-stretch": ki.Props{ "width": units.NewCh(1), }, "#close": ki.Props{ "width": units.NewEx(0.5), "height": units.NewEx(0.5), "margin": units.NewPx(0), "padding": units.NewPx(0), "vertical-align": AlignBottom, }, "#shortcut": ki.Props{ "margin": units.NewPx(0), "padding": units.NewPx(0), }, "#sc-stretch": ki.Props{ "min-width": units.NewCh(2), }, ButtonSelectors[ButtonActive]: ki.Props{ "background-color": "linear-gradient(lighter-0, highlight-10)", }, ButtonSelectors[ButtonInactive]: ki.Props{ "border-color": "lighter-50", "color": "lighter-50", }, ButtonSelectors[ButtonHover]: ki.Props{ "background-color": "linear-gradient(highlight-10, highlight-10)", }, ButtonSelectors[ButtonFocus]: ki.Props{ "border-width": units.NewPx(2), "background-color": "linear-gradient(samelight-50, highlight-10)", }, ButtonSelectors[ButtonDown]: ki.Props{ "color": "lighter-90", "background-color": "linear-gradient(highlight-30, highlight-10)", }, ButtonSelectors[ButtonSelected]: ki.Props{ "background-color": "linear-gradient(pref(Select), highlight-10)", }, }
var TabViewProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "border-color": &Prefs.Colors.Border, "border-width": units.NewPx(2), "background-color": &Prefs.Colors.Background, "color": &Prefs.Colors.Font, "max-width": -1, "max-height": -1, }
var TextFieldBlinkMu sync.Mutex
TextFieldBlinkMu is mutex protecting TextFieldBlink updating and access
var TextFieldBlinker *time.Ticker
TextFieldBlinker is the time.Ticker for blinking cursors for text fields, only one of which can be active at at a time
var TextFieldProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "border-width": units.NewPx(1), "cursor-width": units.NewPx(3), "border-color": &Prefs.Colors.Border, "padding": units.NewPx(4), "margin": units.NewPx(1), "text-align": AlignLeft, "color": &Prefs.Colors.Font, "background-color": &Prefs.Colors.Control, "clear-act": true, "#clear": ki.Props{ "width": units.NewEx(0.5), "height": units.NewEx(0.5), "margin": units.NewPx(0), "padding": units.NewPx(0), "vertical-align": AlignMiddle, }, TextFieldSelectors[TextFieldActive]: ki.Props{ "background-color": "lighter-0", }, TextFieldSelectors[TextFieldFocus]: ki.Props{ "border-width": units.NewPx(2), "background-color": "samelight-80", }, TextFieldSelectors[TextFieldInactive]: ki.Props{ "background-color": "highlight-10", }, TextFieldSelectors[TextFieldSel]: ki.Props{ "background-color": &Prefs.Colors.Select, }, }
var TextFieldSelectors = []string{":active", ":focus", ":inactive", ":selected"}
Style selector names for the different states
var TextFieldSpriteName = "gi.TextField.Cursor"
TextFieldSpriteName is the name of the window sprite used for the cursor
var TextFontRenderMu sync.Mutex
TextFontRenderMu mutex is required because multiple different goroutines associated with different windows can (and often will be) call font stuff at the same time (curFace.GlyphAdvance, rendering font) at the same time, on the same font face -- and that turns out not to work!
var ToolBarProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "padding": units.NewPx(2), "margin": units.NewPx(0), "spacing": units.NewPx(4), "color": &Prefs.Colors.Font, "background-color": "linear-gradient(pref(Control), highlight-10)", }
var TooltipFrameProps = ki.Props{ "background-color": &Prefs.Colors.Highlight, "border-width": units.NewPx(0), "border-color": "none", "margin": units.NewPx(0), "padding": units.NewPx(2), "box-shadow.h-offset": units.NewPx(0), "box-shadow.v-offset": units.NewPx(0), "box-shadow.blur": units.NewPx(0), "box-shadow.color": &Prefs.Colors.Shadow, }
URLHandler is used to handle URL links, if non-nil -- set this to your own handler to process URL's, depending on TextLinkHandler -- the default version of this function just calls oswin.TheApp.OpenURL -- setting this to nil will prevent any links from being open that way, and your own function will have full responsibility for links if set (i.e., the return value is ignored)
var Update2DTrace bool = false
Update2DTrace reports a trace of updates that trigger re-rendering -- can be set in PrefsDebug from prefs gui
var Viewport2DProps = ki.Props{ "EnumType:Flag": KiT_VpFlags, "color": &Prefs.Colors.Font, "background-color": &Prefs.Colors.Background, }
var WidgetBaseProps = ki.Props{ "base-type": true, "EnumType:Flag": KiT_NodeFlags, }
var WidgetDefPropsKey = "__DefProps"
WidgetDefPropsKey is the key for accessing the default style properties stored in the type-properties for a given type -- also ones with sub-selectors for parts in there with selector appended to this key
var WidgetDefStyleKey = "__DefStyle"
WidgetDefStyleKey is the key for accessing the default style stored in the type-properties for a given type -- also ones with sub-selectors for parts in there with selector appended to this key
var WinEventTrace = false
WinEventTrace reports a trace of window events to stdout can be set in PrefsDebug from prefs gui excludes mouse move events
var WinGeomNoLockErr = errors.New("WinGeom could not lock lock file")
var WinGeomPrefs = WindowGeomPrefs{}
var WinGeomPrefsFileName = "win_geom_prefs"
WinGeomPrefsFileName is the base name of the preferences file in GoGi prefs directory
var WinGeomPrefsLastSave time.Time
WinGeomPrefsLastSave is when prefs were last saved -- if we weren't the last to save then we need to re-open before modifying
var WinGeomPrefsLockSleep = 100 * time.Millisecond
var WinGeomPrefsMu sync.RWMutex
WinGeomPrefsMu is read-write mutex that protects updating of WinGeomPrefs
var WinGeomTrace = false
var WinNewCloseTime time.Time
WinNewCloseTime records last time a new window was opened or another closed -- used to trigger updating of Window menus on each window.
var WinPublishTrace = false
WinPublishTrace reports the stack trace leading up to win publish events which are expensive -- wrap multiple updates in UpdateStart / End to prevent can be set in PrefsDebug from prefs gui
var WinWait sync.WaitGroup
WinWait is a wait group for waiting for all the open window event loops to finish -- this can be used for cases where the initial main run uses a GoStartEventLoop for example. It is incremented by GoStartEventLoop and decremented when the event loop terminates.
var WindowGlobalMu sync.Mutex
WindowGlobalMu is a mutex for any global state associated with windows
var WindowOpenTimer time.Time
WindowOpenTimer is used for profiling the open time of windows if doing profiling, it will report the time elapsed in msec to point of establishing initial focus in the window.
var WindowProps = ki.Props{ "EnumType:Flag": KiT_WinFlags, }
var ZoomFactor = float32(1.0)
ZoomFactor is a temporary multiplier on LogicalDPI used for per-session display zooming without changing prefs -- see SaveZoom to save prefs with this current factor.
Functions ¶
func AddToSpellModel ¶
AddToSpellModel trains on additional text - extends model
func AppName ¶ added in v0.9.7
func AppName() string
AppName returns the application name -- see SetAppName to set
func ChoiceDialog ¶
ChoiceDialog presents any number of buttons with labels as given, for the user to choose among -- the clicked button number (starting at 0) will be sent to the receiving object and function for dialog signals. Viewport is optional to properly contextualize dialog to given master window.
func CompleteEditText ¶ added in v0.9.6
CompleteEditText is a chance to modify the completion selection before it is inserted
func CompleteText ¶ added in v0.9.6
CompleteText is the function for completing text files
func CopyGradient ¶
CopyGradient copies a gradient, making new copies of the stops instead of re-using pointers
func DNDModCursor ¶
DNDModCursor gets the appropriate cursor based on the DND event mod.
func DefaultColorSchemes ¶ added in v0.9.11
func DefaultColorSchemes() map[string]*ColorPrefs
func EndCPUMemProfile ¶
func EndCPUMemProfile()
EndCPUMemProfile ends the standard Go cpu and memory profiling.
func EndTargProfile ¶
func EndTargProfile()
EndTargProfile ends targeted profiling and prints report.
func FindEllipseCenter ¶
func FindEllipseCenter(rx, ry *float32, rotX, startX, startY, endX, endY float32, sweep, largeArc bool) (cx, cy float32)
FindEllipseCenter locates the center of the Ellipse if it exists. If it does not exist, the radius values will be increased minimally for a solution to be possible while preserving the rx to rb ratio. rx and rb arguments are pointers that can be checked after the call to see if the values changed. This method uses coordinate transformations to reduce the problem to finding the center of a circle that includes the origin and an arbitrary point. The center of the circle is then transformed back to the original coordinates and returned.
func FixFontMods ¶
FixFontMods ensures that standard font modifiers have a space in front of them, and that the default is not in the name -- used for regularizing font names.
func FixGradientStops ¶
FixGradientStops applies the CSS rules to regularize the gradient stops: https://www.w3.org/TR/css3-images/#color-stop-syntax
func FontAlts ¶
FontAlts generates a list of all possible alternative fonts that actually exist in font library for a list of font families, and a guess as to whether the font is a serif (vs sans) or monospaced (vs proportional) font. Only deals with base names.
func FontFaceName ¶
func FontFaceName(fam string, str FontStretch, wt FontWeights, sty FontStyles) string
FontFaceName returns the best full FaceName to use for the given font family(ies) (comma separated) and modifier parameters
func FontNameFromMods ¶
func FontNameFromMods(basenm string, str FontStretch, wt FontWeights, sty FontStyles) string
FontNameFromMods generates the appropriate regularized file name based on base name and modifiers
func FontNameToMods ¶
func FontNameToMods(fn string) (basenm string, str FontStretch, wt FontWeights, sty FontStyles)
FontNameToMods parses the regularized font name and returns the appropriate base name and associated font mods.
func FontSerifMonoGuess ¶
FontSerifMonoGuess looks at a list of alternative font names and tires to guess if the font is a serif (vs sans) or monospaced (vs proportional) font.
func GrabRenderFrom ¶ added in v0.9.8
GrabRenderFrom grabs the rendered image from given node if nil, then image could not be grabbed
func HSLtoRGBf32 ¶
HSLtoRGBf32 converts HSL values to RGB float32 0..1 values (non alpha-premultiplied) -- based on https://stackoverflow.com/questions/2353211/hsl-to-rgb-color-conversion, https://www.w3.org/TR/css-color-3/ and github.com/lucasb-eyer/go-colorful
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 Init ¶
func Init()
Init performs overall initialization of the gogi system: loading prefs, etc -- automatically called when new window opened, but can be called before then if pref info needed.
func InitSpell ¶
func InitSpell() error
InitSpell tries to load the saved fuzzy.spell model. If unsuccessful tries to create a new model from a text file used as input
func IsAlignEnd ¶
is this a generalized alignment to end of container?
func IsAlignMiddle ¶
is this a generalized alignment to middle of container?
func IsAlignStart ¶
is this a generalized alignment to start of container?
func KiToNode2D ¶
func KiToNode2D(k ki.Ki) (Node2D, *Node2DBase)
KiToNode2D converts Ki to a Node2D interface and a Node2DBase obj -- nil if not.
func MainMenuFunc ¶
MainMenuFunc is the callback function for OS-generated menu actions.
func NewKiDialogValues ¶
NewKiDialogValues gets the user-set values from a NewKiDialog.
func NewSpellModelFromText ¶
func NewSpellModelFromText() error
NewSpellModelFromText builds a NEW spelling model from text
func NextRuneAt ¶
NextRuneAt returns the next rune starting from given index -- could be at that index or some point thereafter -- returns utf8.RuneError if no valid rune could be found -- this should be a standard function!
func OpenImage ¶
OpenImage opens an image from given path filename -- format is inferred automatically.
func OpenSpellModel ¶ added in v0.9.14
func OpenSpellModel() error
OpenSpellModel loads a saved spelling model
func OpenURL ¶ added in v0.9.9
func OpenURL(url string)
OpenURL opens the given URL in the user's default browser. On Linux this requires that xdg-utils package has been installed -- uses xdg-open command.
func ParseDashesString ¶
ParseDashesString gets a dash slice from given string
func PollEvents ¶ added in v0.9.9
func PollEvents()
PollEvents tells the main event loop to check for any gui events right now. Call this periodically from longer-running functions to ensure GUI responsiveness.
func PopupIsCompleter ¶
PopupIsCompleter returns true if the given popup item is a menu and a completer
func PopupIsCorrector ¶
PopupIsCorrector returns true if the given popup item is a menu and a spell corrector
func PopupIsMenu ¶
PopupIsMenu returns true if the given popup item is a menu
func PopupIsTooltip ¶
PopupIsTooltip returns true if the given popup item is a menu
func PromptDialog ¶
PromptDialog opens a basic standard dialog with a title, prompt, and ok / cancel buttons -- any empty text will not be added -- optionally connects to given signal receiving object and function for dialog signals (nil to ignore). Viewport is optional to properly contextualize dialog to given master window.
func RGBtoHSLf32 ¶
RGBtoHSLf32 converts RGB 0..1 values (non alpha-premultiplied) to HSL -- based on https://stackoverflow.com/questions/2353211/hsl-to-rgb-color-conversion, https://www.w3.org/TR/css-color-3/ and github.com/lucasb-eyer/go-colorful
func SaveImage ¶ added in v0.9.8
SaveImage saves image to file, with format inferred from filename -- JPEG and PNG supported by default.
func SaveSpellModel ¶
func SaveSpellModel() error
SaveSpellModel saves the spelling model which includes the data and parameters
func SetActiveKeyMap ¶
func SetActiveKeyMap(km *KeyMap, kmName KeyMapName)
SetActiveKeyMap sets the current ActiveKeyMap, calling Update on the map prior to setting it to ensure that it is a valid, complete map
func SetActiveKeyMapName ¶
func SetActiveKeyMapName(mapnm KeyMapName)
SetActiveKeyMapName sets the current ActiveKeyMap by name from those defined in AvailKeyMaps, calling Update on the map prior to setting it to ensure that it is a valid, complete map
func SetAppAbout ¶ added in v0.9.7
func SetAppAbout(about string)
SetAppAbout sets the 'about' info for the app -- appears as a menu option in the default app menu
func SetAppName ¶ added in v0.9.7
func SetAppName(name string)
SetAppName sets the application name -- defaults to GoGi if not otherwise set Name appears in the first app menu, and specifies the default application-specific preferences directory, etc
func SetGradientBounds ¶
SetGradientBounds sets bounds of the gradient
func SetHTMLSimpleTag ¶
SetHTMLSimpleTag sets the styling parameters for simple html style tags that only require updating the given font spec values -- returns true if handled https://www.w3schools.com/cssref/css_default_values.asp
func SetQuitCleanFunc ¶ added in v0.9.7
func SetQuitCleanFunc(fun func())
SetQuitCleanFunc sets the function that is called whenever app is actually about to quit (irrevocably) -- can do any necessary last-minute cleanup here.
func SetQuitReqFunc ¶ added in v0.9.7
func SetQuitReqFunc(fun func())
SetQuitReqFunc sets the function that is called whenever there is a request to quit the app (via a OS or a call to QuitReq() method). That function can then adjudicate whether and when to actually call Quit.
func SetStylePropsXML ¶
SetStylePropsXML sets style props from XML style string, which contains ';' separated name: value pairs
func ShortcutForFun ¶
ShortcutForFun returns OS-specific formatted shortcut for first key chord trigger for given KeyFun in the current active map
func SignalViewport2D ¶
SignalViewport2D is called by each node in scenegraph through its NodeSig signal to notify its parent viewport whenever it changes, causing a re-render.
func SignalWindowPublish ¶
SignalWindowPublish is the signal receiver function that publishes the window updates when the window update signal (UpdateEnd) occurs
func StartCPUMemProfile ¶
func StartCPUMemProfile()
StartCPUMemProfile starts the standard Go cpu and memory profiling.
func StartTargProfile ¶
func StartTargProfile()
StartTargProfile starts targeted profiling using goki prof package.
func StringPromptDialogValue ¶
StringPromptDialogValue gets the string value the user set.
func StringsAddExtras ¶ added in v0.9.4
StringsAddExtras is a generic function for appending a slice to a slice used to add items to menus
func StringsAppendIfUnique ¶ added in v0.9.4
StringsAppendIfUnique append str to strs if not already in slice
func StringsDelete ¶ added in v0.9.8
StringsDelete deletes item from strings list
func StringsInsertFirst ¶
StringsInsertFirst inserts the given string at start of a string slice, while keeping overall length to given max value useful for a "recents" kind of string list
func StringsInsertFirstUnique ¶
StringsInsertFirstUnique inserts the given string at start of a string slice, while keeping overall length to given max value. if item is already on the list, then it is moved to the top and not re-added (unique items only) useful for a "recents" kind of string list
func StringsRemoveExtras ¶ added in v0.9.4
StringsRemoveExtras is a generic function for removing items of a slice from another slice
func StyleInhInit ¶ added in v0.9.8
func StyleInhInit(val, par interface{}) (inh, init bool)
StyleInhInit detects the style values of "inherit" and "initial", setting the corresponding bool return values
func StyleSetError ¶ added in v0.9.8
func StyleSetError(key string, val interface{})
StyleSetError reports that cannot set property of given key with given value
func SubProps ¶
SubProps returns a sub-property map from given prop map for a given styling selector (property name) -- e.g., :normal :active :hover etc -- returns false if not found
func TextFieldBlink ¶
func TextFieldBlink()
TextFieldBlink is function that blinks text field cursor
func ToLabel ¶
func ToLabel(it interface{}) string
ToLabel returns the gui-appropriate label for an item, using the Labeler interface if it is defined, and falling back on kit.ToString converter otherwise -- also contains label impls for basic interface types for which we cannot easily define the Labeler interface
func WinNewCloseStamp ¶
func WinNewCloseStamp()
WinNewCloseStamp updates the global WinNewCloseTime timestamp for updating windows menus
Types ¶
type ActOpts ¶
type ActOpts struct { Name string Label string Icon string Tooltip string Shortcut key.Chord ShortcutKey KeyFuns Data interface{} UpdateFunc func(act *Action) }
ActOpts provides named and partial parameters for AddAction method
type Action ¶
type Action struct { ButtonBase Data interface{} `json:"-" xml:"-" view:"-" desc:"optional data that is sent with the ActionSig when it is emitted"` ActionSig ki.Signal `` /* 157-byte string literal not displayed */ UpdateFunc func(act *Action) `` /* 176-byte string literal not displayed */ }
Action is a button widget that can display a text label and / or an icon and / or a keyboard shortcut -- this is what is put in menus, menubars, and toolbars, and also for any standalone simple action. The default styling differs depending on whether it is in a Menu versus a MenuBar or ToolBar -- this is controlled by the Class which is automatically set to menu, menubar, or toolbar
func AddNewAction ¶ added in v0.9.7
AddNewAction adds a new action to given parent node, with given name.
func (*Action) ButtonRelease ¶
func (ac *Action) ButtonRelease()
ButtonRelease triggers action signal
func (*Action) ConfigParts ¶
func (ac *Action) ConfigParts()
ConfigParts switches on part type on calls specific config
func (*Action) ConfigPartsAddShortcut ¶
func (ac *Action) ConfigPartsAddShortcut(config *kit.TypeAndNameList) int
ConfigPartsAddShortcut adds a menu shortcut, with a stretch space -- only called when needed
func (*Action) ConfigPartsButton ¶
func (ac *Action) ConfigPartsButton()
ConfigPartsButton sets the label, icon etc for the button
func (*Action) ConfigPartsMenuItem ¶
func (ac *Action) ConfigPartsMenuItem()
ConfigPartsMenuItem sets the label, icon, etc for action menu item
func (*Action) ConfigPartsShortcut ¶
ConfigPartsShortcut sets the shortcut
func (*Action) CopyFieldsFrom ¶ added in v0.9.8
func (ac *Action) CopyFieldsFrom(frm interface{})
func (*Action) Disconnect ¶ added in v0.9.8
func (ac *Action) Disconnect()
func (*Action) Init2D ¶
func (ac *Action) Init2D()
Init2D calls functions to initialize widget and parts
func (*Action) Trigger ¶
func (ac *Action) Trigger()
Trigger triggers the action signal -- for external activation of action -- only works if action is not inactive
func (*Action) UpdateActions ¶
func (ac *Action) UpdateActions()
UpdateActions calls UpdateFunc on me and any of my menu items
type Align ¶
type Align int32
Align has all different types of alignment -- only some are applicable to different contexts, but there is also so much overlap that it makes sense to have them all in one list -- some are not standard CSS and used by layout
const ( AlignLeft Align = iota AlignTop AlignCenter // middle = vertical version of center AlignMiddle AlignRight AlignBottom AlignBaseline // same as CSS space-between AlignJustify AlignSpaceAround AlignFlexStart AlignFlexEnd AlignTextTop AlignTextBottom // align to subscript AlignSub // align to superscript AlignSuper AlignN )
func (*Align) FromString ¶
func (Align) MarshalJSON ¶
func (*Align) UnmarshalJSON ¶
type BaselineShifts ¶
type BaselineShifts int32
BaselineShifts are for super / sub script
const ( ShiftBaseline BaselineShifts = iota ShiftSuper ShiftSub BaselineShiftsN )
func (*BaselineShifts) FromString ¶
func (i *BaselineShifts) FromString(s string) error
func (BaselineShifts) MarshalJSON ¶
func (ev BaselineShifts) MarshalJSON() ([]byte, error)
func (BaselineShifts) String ¶
func (i BaselineShifts) String() string
func (*BaselineShifts) UnmarshalJSON ¶
func (ev *BaselineShifts) UnmarshalJSON(b []byte) error
type Bitmap ¶
type Bitmap struct { WidgetBase Filename FileName `desc:"file name of image loaded -- set by OpenImage"` Size image.Point `desc:"size of the image"` Pixels *image.RGBA `copy:"-" view:"-" xml:"-" json:"-" desc:"the bitmap image"` }
Bitmap is a Widget that is optimized to render a static bitmap image -- it expects to be a terminal node and does NOT call rendering etc on its children. It is particularly useful for overlays in drag-n-drop uses -- can grab the image of another vp and show that
func AddNewBitmap ¶ added in v0.9.7
AddNewBitmap adds a new bitmap to given parent node, with given name.
func (*Bitmap) CopyFieldsFrom ¶ added in v0.9.8
func (bm *Bitmap) CopyFieldsFrom(frm interface{})
func (*Bitmap) DrawIntoViewport ¶ added in v0.9.8
func (bm *Bitmap) DrawIntoViewport(parVp *Viewport2D)
func (*Bitmap) GrabRenderFrom ¶
GrabRenderFrom grabs the rendered image from given node
func (*Bitmap) LayoutToImgSize ¶ added in v0.9.9
func (bm *Bitmap) LayoutToImgSize()
LayoutToImgSize sets the width, height properties to the current Size so it will request that size during layout
func (*Bitmap) OpenImage ¶
OpenImage opens an image for the bitmap, and resizes to the size of the image or the specified size -- pass 0 for width and/or height to use the actual image size for that dimension
type BorderDrawStyle ¶
type BorderDrawStyle int32
BorderDrawStyle determines how to draw the border
const ( BorderSolid BorderDrawStyle = iota BorderDotted BorderDashed BorderDouble BorderGroove BorderRidge BorderInset BorderOutset BorderNone BorderHidden BorderN )
func (*BorderDrawStyle) FromString ¶
func (i *BorderDrawStyle) FromString(s string) error
func (BorderDrawStyle) MarshalJSON ¶
func (ev BorderDrawStyle) MarshalJSON() ([]byte, error)
func (BorderDrawStyle) String ¶
func (i BorderDrawStyle) String() string
func (*BorderDrawStyle) UnmarshalJSON ¶
func (ev *BorderDrawStyle) UnmarshalJSON(b []byte) error
type BorderStyle ¶
type BorderStyle struct { Style BorderDrawStyle `xml:"style" desc:"prop: border-style = how to draw the border"` Width units.Value `xml:"width" desc:"prop: border-width = width of the border"` Radius units.Value `xml:"radius" desc:"prop: border-radius = rounding of the corners"` Color Color `xml:"color" desc:"prop: border-color = color of the border"` }
BorderStyle contains style parameters for borders
func (*BorderStyle) ToDots ¶ added in v0.9.8
func (bs *BorderStyle) ToDots(uc *units.Context)
ToDots runs ToDots on unit values, to compile down to raw pixels
type BoxSides ¶
type BoxSides int32
BoxSides specifies sides of a box -- some properties can be specified per each side (e.g., border) or not
func (*BoxSides) FromString ¶
func (BoxSides) MarshalJSON ¶
func (*BoxSides) UnmarshalJSON ¶
type Button ¶
type Button struct {
ButtonBase
}
Button is a standard command button -- PushButton in Qt Widgets, and Button in Qt Quick -- by default it puts the icon to the left and the text to the right
func AddNewButton ¶ added in v0.9.7
AddNewButton adds a new button to given parent node, with given name.
func (*Button) CopyFieldsFrom ¶ added in v0.9.8
func (bt *Button) CopyFieldsFrom(frm interface{})
type ButtonBase ¶
type ButtonBase struct { PartsWidgetBase Text string `xml:"text" desc:"label for the button -- if blank then no label is presented"` Icon IconName `` /* 162-byte string literal not displayed */ Indicator IconName `` /* 192-byte string literal not displayed */ Shortcut key.Chord `` /* 489-byte string literal not displayed */ StateStyles [ButtonStatesN]Style `` /* 246-byte string literal not displayed */ State ButtonStates `copy:"-" json:"-" xml:"-" desc:"current state of the button based on gui interaction"` ButtonSig ki.Signal `copy:"-" json:"-" xml:"-" view:"-" desc:"signal for button -- see ButtonSignals for the types"` Menu Menu `desc:"the menu items for this menu -- typically add Action elements for menus, along with separators"` MakeMenuFunc MakeMenuFunc `` /* 126-byte string literal not displayed */ }
ButtonBase has common button functionality for all buttons, including Button, Action, MenuButton, CheckBox, etc
func (*ButtonBase) AsButtonBase ¶ added in v0.9.8
func (bb *ButtonBase) AsButtonBase() *ButtonBase
func (*ButtonBase) BaseButtonRelease ¶ added in v0.9.11
func (bb *ButtonBase) BaseButtonRelease()
BaseButtonRelease action: the button has just been released -- sends a released signal and returns state to normal, and emits clicked signal if if it was previously in pressed state
func (*ButtonBase) ButtonEnterHover ¶
func (bb *ButtonBase) ButtonEnterHover()
ButtonEnterHover called when button starting hover
func (*ButtonBase) ButtonEvents ¶
func (bb *ButtonBase) ButtonEvents()
func (*ButtonBase) ButtonExitHover ¶
func (bb *ButtonBase) ButtonExitHover()
ButtonExitHover called when button exiting hover
func (*ButtonBase) ButtonPress ¶ added in v0.9.11
func (bb *ButtonBase) ButtonPress()
ButtonPress sets the button in the down state -- mouse clicked down but not yet up -- emits ButtonPressed signal AND WidgetSig Selected signal -- ButtonClicked is down and up
func (*ButtonBase) ButtonRelease ¶
func (bb *ButtonBase) ButtonRelease()
func (*ButtonBase) ConfigParts ¶
func (bb *ButtonBase) ConfigParts()
func (*ButtonBase) ConfigPartsAddIndicator ¶
func (bb *ButtonBase) ConfigPartsAddIndicator(config *kit.TypeAndNameList, defOn bool) int
ConfigPartsAddIndicator adds a menu indicator if there is a menu present, and the Indicator field is not "none" -- defOn = true means default to adding the indicator even if no menu is yet present -- returns the index in Parts of the indicator object, which is named "indicator" -- an "ind-stretch" is added as well to put on the right by default.
func (*ButtonBase) ConfigPartsAddIndicatorSpace ¶
func (bb *ButtonBase) ConfigPartsAddIndicatorSpace(config *kit.TypeAndNameList, defOn bool) int
ConfigPartsAddIndicatorSpace adds indicator with a space instead of a stretch for editable combobox, where textfield then takes up the rest of the space
func (*ButtonBase) ConfigPartsIfNeeded ¶
func (bb *ButtonBase) ConfigPartsIfNeeded()
func (*ButtonBase) ConfigPartsIndicator ¶
func (bb *ButtonBase) ConfigPartsIndicator(indIdx int)
func (*ButtonBase) ConnectEvents2D ¶
func (bb *ButtonBase) ConnectEvents2D()
func (*ButtonBase) CopyFieldsFrom ¶ added in v0.9.8
func (bb *ButtonBase) CopyFieldsFrom(frm interface{})
func (*ButtonBase) Destroy ¶ added in v0.9.14
func (bb *ButtonBase) Destroy()
func (*ButtonBase) Disconnect ¶ added in v0.9.8
func (bb *ButtonBase) Disconnect()
func (*ButtonBase) FocusChanged2D ¶
func (bb *ButtonBase) FocusChanged2D(change FocusChanges)
func (*ButtonBase) HasMenu ¶
func (bb *ButtonBase) HasMenu() bool
HasMenu returns true if there is a menu or menu-making function set, or the explicit ButtonFlagMenu has been set
func (*ButtonBase) HoverTooltipEvent ¶
func (bb *ButtonBase) HoverTooltipEvent()
func (*ButtonBase) Init2D ¶
func (bb *ButtonBase) Init2D()
func (*ButtonBase) IsCheckable ¶
func (bb *ButtonBase) IsCheckable() bool
IsCheckable returns if is this button checkable -- the Checked state is independent of the generic widget selection state
func (*ButtonBase) IsChecked ¶
func (bb *ButtonBase) IsChecked() bool
IsChecked checks if button is checked
func (*ButtonBase) IsMenu ¶
func (bb *ButtonBase) IsMenu() bool
IsMenu returns true this button is on a menu -- it is a menu item
func (*ButtonBase) KeyChordEvent ¶
func (bb *ButtonBase) KeyChordEvent()
KeyChordEvent handles button KeyChord events
func (*ButtonBase) Layout2D ¶
func (bb *ButtonBase) Layout2D(parBBox image.Rectangle, iter int) bool
func (*ButtonBase) MouseEvent ¶
func (bb *ButtonBase) MouseEvent()
MouseEvents handles button MouseEvent
func (*ButtonBase) MouseFocusEvent ¶
func (bb *ButtonBase) MouseFocusEvent()
MouseFocusEvents handles button MouseFocusEvent
func (*ButtonBase) OpenMenu ¶
func (bb *ButtonBase) OpenMenu() bool
OpenMenu will open any menu associated with this element -- returns true if menu opened, false if not
func (*ButtonBase) Render2D ¶
func (bb *ButtonBase) Render2D()
func (*ButtonBase) ResetMenu ¶
func (bb *ButtonBase) ResetMenu()
ResetMenu removes all items in the menu
func (*ButtonBase) SetAsButton ¶
func (bb *ButtonBase) SetAsButton()
SetAsButton clears the explicit ButtonFlagMenu -- if there are menu items or a menu function then it will still behave as a menu
func (*ButtonBase) SetAsMenu ¶
func (bb *ButtonBase) SetAsMenu()
SetAsMenu ensures that this functions as a menu even before menu items are added
func (*ButtonBase) SetButtonState ¶
func (bb *ButtonBase) SetButtonState(state ButtonStates) bool
SetButtonState sets the button state -- returns true if state changed
func (*ButtonBase) SetCheckable ¶
func (bb *ButtonBase) SetCheckable(checkable bool)
SetCheckable sets whether this button is checkable -- emits ButtonToggled signals if so -- the Checked state is independent of the generic widget selection state
func (*ButtonBase) SetChecked ¶
func (bb *ButtonBase) SetChecked(chk bool)
SetChecked sets the checked state of this button -- does not emit signal or update
func (*ButtonBase) SetIcon ¶
func (bb *ButtonBase) SetIcon(iconName string)
SetIcon sets the Icon to given icon name (could be empty or 'none') and updates the button
func (*ButtonBase) SetText ¶
func (bb *ButtonBase) SetText(txt string)
SetText sets the text and updates the button
func (*ButtonBase) Style2D ¶
func (bb *ButtonBase) Style2D()
func (*ButtonBase) StyleButton ¶
func (bb *ButtonBase) StyleButton()
func (*ButtonBase) StyleParts ¶
func (bb *ButtonBase) StyleParts()
func (*ButtonBase) ToggleChecked ¶
func (bb *ButtonBase) ToggleChecked()
ToggleChecked toggles the checked state of this button -- does not emit signal or update
func (*ButtonBase) UpdateButtonStyle ¶
func (bb *ButtonBase) UpdateButtonStyle() bool
UpdateButtonStyle sets the button style based on current state info -- returns true if changed -- restyles parts if so
type ButtonBox ¶ added in v0.9.9
type ButtonBox struct { PartsWidgetBase Items []string `desc:"the list of items (checbox button labels)"` Mutex bool `desc:"make the items mutually exclusive -- checking one turns off all the others"` ButtonSig ki.Signal `` /* 171-byte string literal not displayed */ }
ButtonBox is a widget for containing a set of CheckBox buttons. It can optionally enforce mutual excusivity (i.e., Radio Buttons). The buttons are all in the Parts of the widget and the Parts layout determines how they are displayed.
func AddNewButtonBox ¶ added in v0.9.9
AddNewButtonBox adds a new button to given parent node, with given name.
func (*ButtonBox) BitFlagsValue ¶ added in v0.9.9
BitFlagsValue returns the int64 value for all checkboxes from given BitFlag Enum type (see kit.EnumRegistry) with given value
func (*ButtonBox) ConfigItems ¶ added in v0.9.9
func (bb *ButtonBox) ConfigItems()
func (*ButtonBox) ConfigParts ¶ added in v0.9.9
func (bb *ButtonBox) ConfigParts()
func (*ButtonBox) ConfigPartsIfNeeded ¶ added in v0.9.9
func (bb *ButtonBox) ConfigPartsIfNeeded()
func (*ButtonBox) CopyFieldsFrom ¶ added in v0.9.9
func (bb *ButtonBox) CopyFieldsFrom(frm interface{})
func (*ButtonBox) Disconnect ¶ added in v0.9.9
func (bb *ButtonBox) Disconnect()
func (*ButtonBox) ItemsFromEnum ¶ added in v0.9.9
ItemsFromEnum sets the Items list from an enum type, which must be registered on kit.EnumRegistry.
func (*ButtonBox) ItemsFromEnumList ¶ added in v0.9.9
ItemsFromEnumList sets the Items list from a list of enum values (see kit.EnumRegistry)
func (*ButtonBox) ItemsFromStringList ¶ added in v0.9.9
ItemsFromStringList sets the Items list from a list of string values -- if setFirst then set current item to the first item in the list, and maxLen if > 0 auto-sets the width of the button to the contents, with the given upper limit
func (*ButtonBox) SelectItem ¶ added in v0.9.9
SelectItem activates a given item and emits the ButtonSig signal. This is mainly for Mutex use. returns error if index is out of range.
func (*ButtonBox) UnCheckAll ¶ added in v0.9.9
func (bb *ButtonBox) UnCheckAll()
UnCheckAll unchecks all buttons
type ButtonFlags ¶ added in v0.9.9
type ButtonFlags int
ButtonFlags extend NodeBase NodeFlags to hold button state
const ( // button is checkable -- enables display of check control ButtonFlagCheckable ButtonFlags = ButtonFlags(NodeFlagsN) + iota // button is checked ButtonFlagChecked // Menu flag means that the button is a menu item ButtonFlagMenu ButtonFlagsN )
func StringToButtonFlags ¶ added in v0.9.9
func StringToButtonFlags(s string) (ButtonFlags, error)
func (ButtonFlags) String ¶ added in v0.9.9
func (i ButtonFlags) String() string
type ButtonSignals ¶
type ButtonSignals int64
ButtonSignals are signals that buttons can send
const ( // ButtonClicked is the main signal to check for normal button activation // -- button pressed down and up ButtonClicked ButtonSignals = iota // Pressed means button pushed down but not yet up ButtonPressed // Released means mouse button was released - typically look at // ButtonClicked instead of this one ButtonReleased // Toggled means the checked / unchecked state was toggled -- only sent // for buttons with Checkable flag set ButtonToggled ButtonSignalsN )
func (*ButtonSignals) FromString ¶
func (i *ButtonSignals) FromString(s string) error
func (ButtonSignals) String ¶
func (i ButtonSignals) String() string
type ButtonStates ¶
type ButtonStates int32
mutually-exclusive button states -- determines appearance
const ( // normal active state -- there but not being interacted with ButtonActive ButtonStates = iota // inactive -- not pressable -- no events ButtonInactive // mouse is hovering over the button ButtonHover // button is the focus -- will respond to keyboard input ButtonFocus // button is currently being pressed down ButtonDown // button has been selected -- selection is a general widget property used // by views and other complex widgets -- checked state is independent of this ButtonSelected // total number of button states ButtonStatesN )
func (*ButtonStates) FromString ¶
func (i *ButtonStates) FromString(s string) error
func (ButtonStates) MarshalJSON ¶
func (ev ButtonStates) MarshalJSON() ([]byte, error)
func (ButtonStates) String ¶
func (i ButtonStates) String() string
func (*ButtonStates) UnmarshalJSON ¶
func (ev *ButtonStates) UnmarshalJSON(b []byte) error
type ButtonWidget ¶
type ButtonWidget interface { // AsButtonBase gets the button base for most basic functions -- reduces // interface size. AsButtonBase() *ButtonBase // ButtonRelease is called for release of button -- this is where buttons // actually differ in functionality. ButtonRelease() // StyleParts is called during Style2D to handle styling associated with // parts -- icons mainly. StyleParts() // ConfigParts configures the parts of the button -- called during init // and style. ConfigParts() // ConfigPartsIfNeeded configures the parts of the button, only if needed // -- called during layout and render ConfigPartsIfNeeded() }
ButtonWidget is an interface for button widgets allowing ButtonBase defaults to handle most cases.
type CheckBox ¶
type CheckBox struct { ButtonBase IconOff IconName `` /* 161-byte string literal not displayed */ }
CheckBox toggles between a checked and unchecked state
func AddNewCheckBox ¶ added in v0.9.7
AddNewCheckBox adds a new button to given parent node, with given name.
func (*CheckBox) AsButtonBase ¶ added in v0.9.8
func (cb *CheckBox) AsButtonBase() *ButtonBase
func (*CheckBox) ButtonRelease ¶
func (cb *CheckBox) ButtonRelease()
func (*CheckBox) ConfigParts ¶
func (cb *CheckBox) ConfigParts()
func (*CheckBox) ConfigPartsIfNeeded ¶
func (cb *CheckBox) ConfigPartsIfNeeded()
func (*CheckBox) CopyFieldsFrom ¶ added in v0.9.8
func (cb *CheckBox) CopyFieldsFrom(frm interface{})
func (*CheckBox) SetIconProps ¶
SetIconProps sets the icon properties from given property list -- parent types can use this to set different icon properties
func (*CheckBox) SetIcons ¶
SetIcons sets the Icons (by name) for the On (checked) and Off (unchecked) states, and updates button
func (*CheckBox) StyleParts ¶
func (cb *CheckBox) StyleParts()
type Clipper ¶
type Clipper interface { // MimeData adds mimedata to given record to represent item on clipboard MimeData(md *mimedata.Mimes) // Copy copies item to the clipboard // e.g., use oswin.TheApp.ClipBoard(tv.Viewport.Win.OSWin).Write(md) // where md is mime-encoded data for the object Copy(reset bool) // Cut cuts item to the clipboard, typically calls Copy and then deletes // itself Cut() // Paste pastes from clipboard to item, e.g., // md := oswin.TheApp.ClipBoard(tv.Viewport.Win.OSWin).Read([]string{filecat.DataJson}) // reads mime-encoded data from the clipboard, in this case in the JSON format Paste() }
Clipper is the interface for standard clipboard operations Types can use this interface to support extensible clip functionality used in all relevant valueview types in giv package (e.g., TreeView)
type Color ¶
type Color struct {
R, G, B, A uint8
}
Color extends image/color.RGBA with more methods for converting to / from strings etc -- it has standard uint8 0..255 color values
var NilColor Color
func ColorFromName ¶ added in v0.9.11
ColorFromName returns a new color set from given name.
func ColorFromString ¶
ColorFromString returns a new color set from given string and optional base color for transforms -- see SetString
func (*Color) Add ¶ added in v0.9.11
Add adds given color deltas to this color, safely avoiding overflow > 255
func (*Color) Blend ¶
Blend returns a color that is the given percent blend between current color and given clr -- 10 = 10% of the clr and 90% of the current color, etc -- blending is done directly on non-pre-multiplied RGB values
func (*Color) Clearer ¶
Clearer returns a color that is given percent more transparent (lower alpha value) relative to current alpha level
func (*Color) Darker ¶
Darker returns a color that is darker by the given percent, e.g., 50 = 50% darker, relative to maximum possible darkness -- converts to HSL, multiplies the L factor, and then converts back to RGBA
func (*Color) HexString ¶ added in v0.9.8
HexString returns colors using standard 2-hexadecimal-digits-per-component string
func (*Color) Highlight ¶
Highlight returns a color that is either lighter or darker by the given percent, e.g., 50 = 50% change relative to maximum possible lightness, depending on how light the color is already -- if lightness > 50% then goes darker, and vice-versa
func (*Color) IsDark ¶ added in v0.9.11
IsDark checks if HSL lightness value is < .6, which is a good value for distinguishing when white vs. black text should be used as a contrast color.
func (*Color) IsNil ¶
IsNil checks if color is the nil initial default color -- a = 0 means fully transparent black
func (*Color) Lighter ¶
Lighter returns a color that is lighter by the given percent, e.g., 50 = 50% lighter, relative to maximum possible lightness -- converts to HSL, multiplies the L factor, and then converts back to RGBA
func (*Color) Opaquer ¶
Opaquer returns a color that is given percent more opaque (higher alpha value) relative to current alpha level
func (*Color) Pastel ¶
Pastel returns a color that is less saturated (more pastel-like) by the given percent: 100 = 100% less saturated (i.e., grey) -- converts to HSL, multiplies the S factor, and then converts back to RGBA
func (*Color) Samelight ¶
Samelight is the opposite of Highlight -- makes a color darker if already darker than 50%, and lighter if already lighter than 50%
func (*Color) Saturate ¶
Saturate returns a color that is more saturated by the given percent: 100 = 100% more saturated, etc -- converts to HSL, multiplies the S factor, and then converts back to RGBA
func (*Color) SetAlphaPreFix ¶ added in v0.9.11
AlphaPreFix detects if the color is not alpha-premultiplied (i.e., any RGB > A), and converts to alpha-premultiplied if so. Returns true if fixed.
func (*Color) SetAlphaPreMult ¶ added in v0.9.11
SetAlphaPreMult converts a non-alpha-premultiplied color to a premultiplied one. Returns true if a change was made (i.e., if A < 255).
func (*Color) SetFloat32 ¶
SetFloat32 converts from 0-1 normalized floating point numbers (alpha-premultiplied)
func (*Color) SetFloat64 ¶
SetFloat64 convert from 0-1 normalized floating point numbers (alpha-premultiplied)
func (*Color) SetHSL ¶
SetHSL converts from HSL: [0..360], Saturation [0..1], and Luminance (lightness) [0..1] of the color using float32 values
func (*Color) SetHSLA ¶
SetHSLA converts from HSLA: [0..360], Saturation [0..1], and Luminance (lightness) [0..1] of the color using float32 values
func (*Color) SetIFace ¶ added in v0.9.8
func (c *Color) SetIFace(val interface{}, vp *Viewport2D, key string) error
SetIFace sets the color from given interface value, e.g., for ki.Props key is an optional property key for error -- always logs errors
func (*Color) SetNPFloat32 ¶
SetNPFloat converts from 0-1 normalized floating point numbers, non alpha-premultiplied
func (*Color) SetName ¶ added in v0.9.8
SetName sets color value from a standard color name. returns error if name not found. use ColorName type to present user with a chooser.
func (*Color) SetNotAlphaPreMult ¶ added in v0.9.11
SetNotAlphaPreMult converts a alpha-premultiplied color to a non-premultiplied one. Returns true if a change was made (i.e., if A < 255).
func (*Color) SetString ¶
SetString sets color value from string, including # hex specs, standard color names, "none" or "off", or the following transformations (which use a non-nil base color as the starting point, if it is provided):
* lighter-PCT or darker-PCT: PCT is amount to lighten or darken (using HSL), e.g., 10=10% * saturate-PCT or pastel-PCT: manipulates the saturation level in HSL by PCT * clearer-PCT or opaquer-PCT: manipulates the alpha level by PCT * blend-PCT-color: blends given percent of given color name relative to base (or current)
func (*Color) SetStringStyle ¶
SetStringStyle is the version of SetString used for styling widgets it includes the Viewport is needed for contextual names such as "currentcolor"
func (*Color) SetUInt32 ¶
SetUInt32 sets components from unsigned 32bit integers (alpha-premultiplied)
func (*Color) SetUInt8 ¶
SetUInt8 sets components from unsigned 8 bit integers (alpha-premultiplied)
func (*Color) Sub ¶ added in v0.9.11
Sub subtracts given color deltas from this color, safely avoiding underflow < 0
func (*Color) ToFloat32 ¶
ToFloat32 converts to 0-1 normalized floating point numbers, still alpha-premultiplied
func (*Color) ToHSLA ¶
ToHSLA converts to HSLA: [0..360], Saturation [0..1], and Luminance (lightness) [0..1] of the color using float32 values
func (*Color) ToNPFloat32 ¶
ToNPFloat32 converts to 0-1 normalized floating point numbers, not alpha premultiplied
type ColorName ¶ added in v0.9.8
type ColorName string
ColorName provides a value-view GUI lookup of valid color names
type ColorPrefs ¶
type ColorPrefs struct { HiStyle HiStyleName `desc:"text highilighting style / theme"` Font Color `desc:"default font / pen color"` Background Color `desc:"default background color"` Shadow Color `desc:"color for shadows -- should generally be a darker shade of the background color"` Border Color `desc:"default border color, for button, frame borders, etc"` Control Color `desc:"default main color for controls: buttons, etc"` Icon Color `desc:"color for icons or other solidly-colored, small elements"` Select Color `desc:"color for selected elements"` Highlight Color `desc:"color for highlight background"` Link Color `desc:"color for links in text etc"` }
ColorPrefs specify colors for all major categories of GUI elements, and are used in the default styles.
func (*ColorPrefs) DarkDefaults ¶ added in v0.9.11
func (pf *ColorPrefs) DarkDefaults()
func (*ColorPrefs) Defaults ¶
func (pf *ColorPrefs) Defaults()
func (*ColorPrefs) OpenJSON ¶
func (pf *ColorPrefs) OpenJSON(filename FileName) error
OpenJSON opens colors from a JSON-formatted file.
func (*ColorPrefs) PrefColor ¶
func (pf *ColorPrefs) PrefColor(clrName string) *Color
PrefColor returns preference color of given name (case insensitive)
func (*ColorPrefs) SaveJSON ¶
func (pf *ColorPrefs) SaveJSON(filename FileName) error
SaveJSON saves colors to a JSON-formatted file.
func (*ColorPrefs) SetToPrefs ¶ added in v0.9.11
func (pf *ColorPrefs) SetToPrefs()
SetToPrefs sets this color scheme as the current active setting in overall default prefs.
type ColorSources ¶
type ColorSources int32
ColorSources determine how the color is generated -- used in FillStyle and StrokeStyle
const ( SolidColor ColorSources = iota LinearGradient RadialGradient ColorSourcesN )
func (*ColorSources) FromString ¶
func (i *ColorSources) FromString(s string) error
func (ColorSources) MarshalJSON ¶
func (ev ColorSources) MarshalJSON() ([]byte, error)
func (ColorSources) String ¶
func (i ColorSources) String() string
func (*ColorSources) UnmarshalJSON ¶
func (ev *ColorSources) UnmarshalJSON(b []byte) error
type ColorSpec ¶
type ColorSpec struct { Source ColorSources `desc:"source of color (solid, gradient)"` Color Color `desc:"color for solid color source"` Gradient *rasterx.Gradient `desc:"gradient parameters for gradient color source"` }
ColorSpec fully specifies the color for rendering -- used in FillStyle and StrokeStyle
func (*ColorSpec) ColorOrNil ¶
ColorOrNil returns the solid color if non-nil, or nil otherwise -- for consumers that handle nil colors
func (*ColorSpec) CopyFrom ¶
Copy copies a gradient, making new copies of the stops instead of re-using pointers
func (*ColorSpec) RenderColor ¶
func (cs *ColorSpec) RenderColor(opacity float32, bounds image.Rectangle, xform mat32.Mat2) interface{}
RenderColor gets the color for rendering, applying opacity and bounds for gradients
func (*ColorSpec) SetIFace ¶ added in v0.9.8
func (c *ColorSpec) SetIFace(val interface{}, vp *Viewport2D, key string) error
SetIFace sets the color spec from given interface value, e.g., for ki.Props key is an optional property key for error -- always logs errors
func (*ColorSpec) SetShadowGradient ¶
SetShadowGradient sets a linear gradient starting at given color and going down to transparent based on given color and direction spec (defaults to "to down")
func (*ColorSpec) SetString ¶
func (cs *ColorSpec) SetString(clrstr string, vp *Viewport2D) bool
SetString sets the color spec from a standard CSS-formatted string -- see https://www.w3schools.com/css/css3_gradients.asp -- see UnmarshalXML for XML-based version
func (*ColorSpec) UnmarshalXML ¶
UnmarshalXML parses the given XML-formatted string to set the color specification
type ComboBox ¶
type ComboBox struct { ButtonBase Editable bool `` /* 130-byte string literal not displayed */ CurVal interface{} `json:"-" xml:"-" desc:"current selected value"` CurIndex int `json:"-" xml:"-" desc:"current index in list of possible items"` Items []interface{} `json:"-" xml:"-" desc:"items available for selection"` ItemsMenu Menu `json:"-" xml:"-" desc:"the menu of actions for selecting items -- automatically generated from Items"` ComboSig ki.Signal `` /* 178-byte string literal not displayed */ MaxLength int `desc:"maximum label length (in runes)"` }
func AddNewComboBox ¶ added in v0.9.7
AddNewComboBox adds a new button to given parent node, with given name.
func (*ComboBox) ButtonRelease ¶
func (cb *ComboBox) ButtonRelease()
func (*ComboBox) ConfigParts ¶
func (cb *ComboBox) ConfigParts()
func (*ComboBox) ConfigPartsIconText ¶
func (cb *ComboBox) ConfigPartsIconText(config *kit.TypeAndNameList, icnm string) (icIdx, txIdx int)
ConfigPartsIconText returns a standard config for creating parts, of icon and text left-to right in a row -- always makes text
func (*ComboBox) ConfigPartsIfNeeded ¶
func (cb *ComboBox) ConfigPartsIfNeeded()
func (*ComboBox) ConfigPartsSetText ¶
ConfigPartsSetText sets part style props, using given props if not set in object props
func (*ComboBox) CopyFieldsFrom ¶ added in v0.9.8
func (cb *ComboBox) CopyFieldsFrom(frm interface{})
func (*ComboBox) Disconnect ¶ added in v0.9.8
func (cb *ComboBox) Disconnect()
func (*ComboBox) ItemsFromEnum ¶
ItemsFromEnum sets the Items list from an enum type, which must be registered on kit.EnumRegistry -- if setFirst then set current item to the first item in the list, and maxLen if > 0 auto-sets the width of the button to the contents, with the given upper limit -- see kit.EnumRegistry, and maxLen if > 0 auto-sets the width of the button to the contents, with the given upper limit
func (*ComboBox) ItemsFromEnumList ¶
ItemsFromEnumList sets the Items list from a list of enum values (see kit.EnumRegistry) -- if setFirst then set current item to the first item in the list, and maxLen if > 0 auto-sets the width of the button to the contents, with the given upper limit
func (*ComboBox) ItemsFromStringList ¶
ItemsFromStringList sets the Items list from a list of string values -- if setFirst then set current item to the first item in the list, and maxLen if > 0 auto-sets the width of the button to the contents, with the given upper limit
func (*ComboBox) ItemsFromTypes ¶
ItemsFromTypes sets the Items list from a list of types -- see e.g., AllImplementersOf or AllEmbedsOf in kit.TypeRegistry -- if setFirst then set current item to the first item in the list, sort sorts the list in ascending order, and maxLen if > 0 auto-sets the width of the button to the contents, with the given upper limit
func (*ComboBox) MakeItems ¶
MakeItems makes sure the Items list is made, and if not, or reset is true, creates one with the given capacity
func (*ComboBox) MakeItemsMenu ¶
func (cb *ComboBox) MakeItemsMenu()
MakeItemsMenu makes menu of all the items
func (*ComboBox) SelectItem ¶
SelectItem selects a given item and emits the index as the ComboSig signal and the selected item as the data
func (*ComboBox) SetCurIndex ¶
SetCurIndex sets the current index (CurIndex) and the corresponding CurVal for that item on the current Items list (-1 if not found) -- returns value -- and sets the text to the string value of that value (using standard Stringer string conversion)
func (*ComboBox) SetCurVal ¶
SetCurVal sets the current value (CurVal) and the corresponding CurIndex for that item on the current Items list (adds to items list if not found) -- returns that index -- and sets the text to the string value of that value (using standard Stringer string conversion)
func (*ComboBox) SetToMaxLength ¶
SetToMaxLength gets the maximum label length so that the width of the button label is automatically set according to the max length of all items in the list -- if maxLen > 0 then it is used as an upper do-not-exceed length
type Complete ¶
type Complete struct { ki.Node MatchFunc complete.MatchFunc `desc:"function to get the list of possible completions"` LookupFunc complete.LookupFunc `desc:"function to get the text to show for lookup"` EditFunc complete.EditFunc `desc:"function to edit text using the selected completion"` Context interface{} `desc:"the object that implements complete.Func"` SrcLn int `desc:"line number in source that completion is operating on, if relevant"` SrcCh int `desc:"character position in source that completion is operating on"` Completions complete.Completions `desc:"the list of potential completions"` Seed string `desc:"current completion seed"` CompleteSig ki.Signal `json:"-" xml:"-" view:"-" desc:"signal for complete -- see CompleteSignals for the types"` Completion string `desc:"the user's completion selection'"` Vp *Viewport2D `desc:"the viewport where the current popup menu is presented"` DelayTimer *time.Timer DelayMu sync.Mutex ShowMu sync.Mutex }
Complete holds the current completion data and functions to call for building the list of possible completions and for editing text after a completion is selected
func (*Complete) Abort ¶ added in v0.9.11
Abort aborts *only* pending completions, but does not close existing window. Returns true if aborted.
func (*Complete) Cancel ¶
Cancel cancels any existing *or* pending completion. Call when new events nullify prior completions. Returns true if canceled.
func (*Complete) Complete ¶
Complete emits a signal to let subscribers know that the user has made a selection from the list of possible completions
func (*Complete) Disconnect ¶ added in v0.9.8
func (cm *Complete) Disconnect()
func (*Complete) GetCompletion ¶
func (c *Complete) GetCompletion(s string) complete.Completion
func (*Complete) IsAboutToShow ¶ added in v0.9.11
IsAboutToShow returns true if the DelayTimer is started for preparing to show a completion. note: don't really need to lock
func (*Complete) KeyInput ¶
KeyInput is the opportunity for completion to act on specific key inputs
func (*Complete) Lookup ¶ added in v0.9.11
func (c *Complete) Lookup(text string, posLn, posCh int, vp *Viewport2D, pt image.Point, force bool)
Lookup is the main call for doing lookups
type CompleteSignals ¶
type CompleteSignals int64
CompleteSignals are signals that are sent by Complete
const ( // CompleteSelect means the user chose one of the possible completions CompleteSelect CompleteSignals = iota // CompleteExtend means user has requested that the seed extend if all // completions have a common prefix longer than current seed CompleteExtend )
func (*CompleteSignals) FromString ¶
func (i *CompleteSignals) FromString(s string) error
func (CompleteSignals) String ¶
func (i CompleteSignals) String() string
type Completer ¶ added in v0.9.8
type Completer interface { // SetCompleter sets completion functions so that completions will // automatically be offered as the user types. data provides context where being used. SetCompleter(data interface{}, matchFun complete.MatchFunc, editFun complete.EditFunc) }
Completer interface supports the SetCompleter method for setting completer parameters This is defined e.g., on TextField and TextBuf
type CtxtMenuFunc ¶
CtxtMenuFunc is a function for creating a context menu for given node
type DNDStages ¶ added in v0.9.11
type DNDStages int32
DNDStages indicates stage of DND process
const ( // DNDNotStarted = nothing happening DNDNotStarted DNDStages = iota // DNDStartSent means that the Start event was sent out, but receiver has // not yet started the DND on its end by calling StartDragNDrop DNDStartSent // DNDStarted means that a node called StartDragNDrop DNDStarted // DNDDropped means that drop event has been sent DNDDropped DNDStagesN )
func (*DNDStages) FromString ¶ added in v0.9.11
type Dialog ¶
type Dialog struct { Viewport2D Title string `desc:"title text displayed as the window title for the dialog"` Prompt string `desc:"a prompt string displayed below the title"` Modal bool `desc:"open the dialog in a modal state, blocking all other input"` DefSize image.Point `` /* 200-byte string literal not displayed */ State DialogState `desc:"state of the dialog"` SigVal int64 `` /* 139-byte string literal not displayed */ DialogSig ki.Signal `json:"-" xml:"-" view:"-" desc:"signal for dialog -- sends a signal when opened, accepted, or canceled"` Data interface{} `` /* 188-byte string literal not displayed */ }
Dialog supports dialog functionality -- based on a viewport that can either be rendered in a separate window or on top of an existing one.
func NewKiDialog ¶
func NewKiDialog(avp *Viewport2D, iface reflect.Type, opts DlgOpts, recv ki.Ki, fun ki.RecvFunc) *Dialog
NewKiDialog prompts for creating new item(s) of a given type, showing types that implement given interface. Use construct of form: reflect.TypeOf((*gi.Node2D)(nil)).Elem() Optionally connects to given signal receiving object and function for dialog signals (nil to ignore).
func NewStdDialog ¶
NewStdDialog returns a basic standard dialog with given options (title, prompt, CSS styling) and whether ok, cancel buttons should be shown -- any empty text will not be added -- returns with UpdateStart started but NOT ended -- must call UpdateEnd(true) once done configuring! Use AddOk / NoOk, AddCancel / NoCancel for bool args.
func RecycleStdDialog ¶ added in v0.9.10
RecycleStdDialog looks for existing dialog window with same Data -- if found brings that to the front, returns it, and true bool. else (and if data is nil) calls NewStdDialog, returns false.
func StringPromptDialog ¶
func StringPromptDialog(avp *Viewport2D, strval, placeholder string, opts DlgOpts, recv ki.Ki, fun ki.RecvFunc) *Dialog
StringPromptDialog prompts the user for a string value -- optionally connects to given signal receiving object and function for dialog signals (nil to ignore). Viewport is optional to properly contextualize dialog to given master window.
func (*Dialog) Accept ¶
func (dlg *Dialog) Accept()
Accept accepts the dialog, activated by the default Ok button
func (*Dialog) AddButtonBox ¶
AddButtonBox adds a button box (Row Layout) named "buttons" to given frame, with an extra space above it
func (*Dialog) ButtonBox ¶
ButtonBox returns the ButtonBox layout widget, and its index, within frame -- nil, -1 if not found
func (*Dialog) Cancel ¶
func (dlg *Dialog) Cancel()
Cancel cancels the dialog, activated by the default Cancel button
func (*Dialog) Close ¶
func (dlg *Dialog) Close()
Close requests that the dialog be closed -- it does not alter any state or send any signals
func (*Dialog) Disconnect ¶ added in v0.9.8
func (dlg *Dialog) Disconnect()
func (*Dialog) Frame ¶
Frame returns the main frame for the dialog, assumed to be the first element in the dialog
func (*Dialog) HasFocus2D ¶
func (*Dialog) Open ¶
func (dlg *Dialog) Open(x, y int, avp *Viewport2D, cfgFunc func()) bool
Open this dialog, in given location (0 = middle of window), finding window from given viewport -- returns false if it fails for any reason. optional cvgFunc can perform additional configuration after the dialog window has been created and dialog added to it -- some configs require the window.
func (*Dialog) PromptWidget ¶
Prompt returns the prompt label widget, and its index, within frame -- if nil returns the title widget (flexible if prompt is nil)
func (*Dialog) SetFrame ¶
SetFrame creates a standard vertical column frame layout as first element of the dialog, named "frame"
func (*Dialog) SetPrompt ¶
SetPrompt sets the prompt and adds a Label named "prompt" to the given frame layout if passed
func (*Dialog) SetTitle ¶
SetTitle sets the title and adds a Label named "title" to the given frame layout if passed
func (*Dialog) StdButtonConfig ¶
func (dlg *Dialog) StdButtonConfig(stretch, ok, cancel bool) kit.TypeAndNameList
StdButtonConfig returns a kit.TypeAndNameList for calling on ConfigChildren of a button box, to create standard Ok, Cancel buttons (if true), optionally starting with a Stretch element that will cause the buttons to be arranged on the right -- a space element is added between buttons if more than one
func (*Dialog) StdButtonConnect ¶
StdButtonConnect connects standard buttons in given button box layout to Accept / Cancel actions
type DialogState ¶
type DialogState int64
DialogState indicates the state of the dialog.
const ( // DialogExists is the existential state -- struct exists and is likely // being constructed. DialogExists DialogState = iota // DialogOpenModal means dialog is open in a modal state, blocking all other input. DialogOpenModal // DialogOpenModeless means dialog is open in a modeless state, allowing other input. DialogOpenModeless // DialogAccepted means Ok was pressed -- dialog accepted. DialogAccepted // DialogCanceled means Cancel was pressed -- button canceled. DialogCanceled DialogStateN )
func (*DialogState) FromString ¶
func (i *DialogState) FromString(s string) error
func (DialogState) String ¶
func (i DialogState) String() string
type DlgOpts ¶
type DlgOpts struct { Title string `desc:"generally should be provided -- will also be used for setting name of dialog and associated window"` Prompt string `` /* 153-byte string literal not displayed */ CSS ki.Props `desc:"optional style properties applied to dialog -- can be used to customize any aspect of existing dialogs"` }
DlgOpts are the basic dialog options accepted by all dialog methods -- provides a named, optional way to specify these args
type DragNDropper ¶
type DragNDropper interface { // Drop is called when something is dropped on this item // the mod is either dnd.DropCopy for a copy-like operation (the default) // or dnd.Move for a move-like operation (with Shift key held down) // drop must call Window.FinalizeDragNDrop with the mod actually used // to have the source update itself Drop(md mimedata.Mimes, mod dnd.DropMods) // Dragged is called on source of drag-n-drop after the drop is finalized Dragged(de *dnd.Event) // DropExternal is called when something is dropped on this item from // an external source (not within same app). // the mod is either dnd.DropCopy for a copy-like operation (the default) // or dnd.Move for a move-like operation (with Shift key held down) // drop DOES NOT need to call Window.FinalizeDragNDrop with the mod actually used // to have the source update itself -- no harm if it does however, as the source // will be nil. DropExternal(md mimedata.Mimes, mod dnd.DropMods) }
DragNDropper is the interface for standard drag-n-drop actions Types can use this interface to support extensible DND functionality used in all relevant valueview types in giv package (e.g., TreeView)
type EditorPrefs ¶ added in v0.9.11
type EditorPrefs struct { TabSize int `xml:"tab-size" desc:"size of a tab, in chars -- also determines indent level for space indent"` SpaceIndent bool `xml:"space-indent" desc:"use spaces for indentation, otherwise tabs"` WordWrap bool `xml:"word-wrap" desc:"wrap lines at word boundaries -- otherwise long lines scroll off the end"` LineNos bool `xml:"line-nos" desc:"show line numbers"` Completion bool `xml:"completion" desc:"use the completion system to suggest options while typing"` SpellCorrect bool `xml:"spell-correct" desc:"suggest corrections for unknown words while typing"` AutoIndent bool `xml:"auto-indent" desc:"automatically indent lines when enter, tab, }, etc pressed"` EmacsUndo bool `` /* 182-byte string literal not displayed */ DepthColor bool `xml:"depth-color" desc:"colorize the background according to nesting depth"` }
EditorPrefs contains editor preferences. It can also be set from ki.Props style properties.
func (*EditorPrefs) Defaults ¶ added in v0.9.11
func (pf *EditorPrefs) Defaults()
Defaults are the defaults for EditorPrefs
func (*EditorPrefs) StyleFromProps ¶ added in v0.9.11
func (pf *EditorPrefs) StyleFromProps(props ki.Props)
StyleFromProps styles Slider-specific fields from ki.Prop properties doesn't support inherit or default
type EventMaster ¶ added in v0.9.11
type EventMaster interface { // EventTopNode returns the top-level node for this event scope. // This is also the node that serves as the event sender. // By default it is the Window. EventTopNode() ki.Ki // FocusTopNode returns the top-level node for key event focusing. FocusTopNode() ki.Ki // EventTopUpdateStart does an UpdateStart on top-level node, for batch updates. // This may not be identical to EventTopNode().UpdateStart() for // embedded case where Viewport is the EventTopNode. EventTopUpdateStart() bool // EventTopUpdateEnd does an UpdateEnd on top-level node, for batch updates. // This may not be identical to EventTopNode().UpdateEnd() for // embedded case where Viewport is the EventTopNode. EventTopUpdateEnd(updt bool) // IsInScope returns whether given node is in scope for receiving events IsInScope(node *Node2DBase, popup bool) bool // CurPopupIsTooltip returns true if current popup is a tooltip CurPopupIsTooltip() bool // DeleteTooltip deletes any tooltip popup (called when hover ends) DeleteTooltip() // IsFocusActive returns true if focus is active in this master IsFocusActive() bool // SetFocusActiveState sets focus active state SetFocusActiveState(active bool) }
EventMaster provides additional control methods for the event manager, for things beyond its immediate scope
type EventMgr ¶ added in v0.9.11
type EventMgr struct { Master EventMaster `desc:"master of this event mangager -- handles broader scope issues"` EventSigs [oswin.EventTypeN][EventPrisN]ki.Signal `desc:"signals for communicating each type of event, organized by priority"` EventMu sync.Mutex `desc:"mutex that protects event sending"` TimerMu sync.Mutex `desc:"mutex that protects timer variable updates (e.g., hover AfterFunc's)"` Dragging ki.Ki `desc:"node receiving mouse dragging events -- not for DND but things like sliders -- anchor to same"` Scrolling ki.Ki `desc:"node receiving mouse scrolling events -- anchor to same"` DNDStage DNDStages `desc:"stage of DND process"` DNDData mimedata.Mimes `desc:"drag-n-drop data -- if non-nil, then DND is taking place"` DNDSource ki.Ki `desc:"drag-n-drop source node"` DNDFinalEvent *dnd.Event `desc:"final event for DND which is sent if a finalize is received"` DNDDropMod dnd.DropMods `desc:"modifier in place at time of drop event (DropMove or DropCopy)"` Focus ki.Ki `desc:"node receiving keyboard events -- use SetFocus, CurFocus"` FocusMu sync.RWMutex `desc:"mutex that protects focus updating"` FocusStack []ki.Ki `desc:"stack of focus"` StartFocus ki.Ki `desc:"node to focus on at start when no other focus has been set yet -- use SetStartFocus"` LastModBits int32 `desc:"Last modifier key bits from most recent Mouse, Keyboard events"` LastSelMode mouse.SelectModes `desc:"Last Select Mode from most recent Mouse, Keyboard events"` LastMousePos image.Point `desc:"Last mouse position from most recent Mouse events"` LagSkipDeltaPos image.Point `desc:"change in position accumulated from skipped-over laggy mouse move events"` LagLastSkipped bool `desc:"true if last event was skipped due to lag"` // contains filtered or unexported fields }
EventMgr is an event manager that handles distributing events to nodes. It relies on the EventMaster for a few things outside of its scope.
func (*EventMgr) ActivateStartFocus ¶ added in v0.9.11
ActivateStartFocus activates start focus if there is no current focus and StartFocus is set -- returns true if activated
func (*EventMgr) ClearDND ¶ added in v0.9.11
func (em *EventMgr) ClearDND()
ClearDND clears DND state
func (*EventMgr) ClearNonFocus ¶ added in v0.9.11
ClearNonFocus clears the focus of any non-w.Focus item.
func (*EventMgr) ConnectEvent ¶ added in v0.9.11
ConnectEvent adds a Signal connection for given event type and priority to given receiver
func (*EventMgr) CurFocus ¶ added in v0.9.11
CurFocus gets the current focus node under mutex protection
func (*EventMgr) DNDIsInternalSrc ¶ added in v0.9.11
DNDIsInternalSrc returns true if the source of the DND operation is internal to GoGi system -- otherwise it originated from external OS source.
func (*EventMgr) DNDStart ¶ added in v0.9.11
DNDStart is driven by node responding to start event, actually starts DND
func (*EventMgr) DNDStartEvent ¶ added in v0.9.11
DNDStartEvent handles drag-n-drop start events.
func (*EventMgr) DisconnectAllEvents ¶ added in v0.9.11
DisconnectAllEvents disconnect node from all event signals -- pri is priority -- pass AllPris for all priorities
func (*EventMgr) DisconnectEvent ¶ added in v0.9.11
DisconnectEvent removes Signal connection for given event type to given receiver -- pri is priority -- pass AllPris for all priorities
func (*EventMgr) DoInstaDrag ¶ added in v0.9.11
DoInstaDrag tests whether the given mouse DragEvent is on a widget marked with InstaDrag
func (*EventMgr) FilterLaggyEvents ¶ added in v0.9.11
FilterLaggyEvents filters repeated laggy events -- key for responsive resize, scroll, etc returns false if event should not be processed further, and true if it should. Should only be called when the current event is the same type as last time. Accumulates mouse deltas in LagSkipDeltaPos.
func (*EventMgr) FocusLast ¶ added in v0.9.11
FocusLast sets the focus on the last item in the tree -- returns true if a focusable item was found
func (*EventMgr) FocusNext ¶ added in v0.9.11
FocusNext sets the focus on the next item that can accept focus after the
given item (can be nil) -- returns true if a focus item found.
func (*EventMgr) FocusOnOrNext ¶ added in v0.9.11
FocusOnOrNext sets the focus on the given item, or the next one that can accept focus -- returns true if a new focus item found.
func (*EventMgr) FocusOnOrPrev ¶ added in v0.9.11
FocusOnOrPrev sets the focus on the given item, or the previous one that can accept focus -- returns true if a new focus item found.
func (*EventMgr) FocusPrev ¶ added in v0.9.11
FocusPrev sets the focus on the previous item before the given item (can be nil)
func (*EventMgr) GenDNDFocusEvents ¶ added in v0.9.11
GenDNDFocusEvents processes mouse.MoveEvent to generate dnd.FocusEvent events -- returns true if any such events were sent. If popup is true, then only items on popup are in scope, otherwise items NOT on popup are in scope (if no popup, everything is in scope). Extra work is done to ensure that Exit from prior widget is always sent before Enter to next one.
func (*EventMgr) GenMouseFocusEvents ¶ added in v0.9.11
GenMouseFocusEvents processes mouse.MoveEvent to generate mouse.FocusEvent events -- returns true if any such events were sent. If popup is true, then only items on popup are in scope, otherwise items NOT on popup are in scope (if no popup, everything is in scope).
func (*EventMgr) InitialFocus ¶ added in v0.9.11
func (em *EventMgr) InitialFocus()
InitialFocus establishes the initial focus for the window if no focus is set -- uses ActivateStartFocus or FocusNext as backup.
func (*EventMgr) ManagerKeyChordEvents ¶ added in v0.9.11
func (em *EventMgr) ManagerKeyChordEvents(e *key.ChordEvent)
MangerKeyChordEvents handles lower-priority manager-level key events. Mainly tab, shift-tab, and GoGiEditor and Prefs. event will be marked as processed if handled here.
func (*EventMgr) MouseDragEvents ¶ added in v0.9.11
MouseDragEvents processes MouseDragEvent to Detect start of drag and DND. These require timing and delays, e.g., due to minor wiggles when pressing the mouse button
func (*EventMgr) MouseEventReset ¶ added in v0.9.11
MouseEventReset resets state for "catch" events (Dragging, Scrolling)
func (*EventMgr) MouseEvents ¶ added in v0.9.11
MouseEvents processes mouse drag and move events
func (*EventMgr) MouseMoveEvents ¶ added in v0.9.11
MouseMoveEvents processes MouseMoveEvent to detect start of hover events. These require timing and delays
func (*EventMgr) PopFocus ¶ added in v0.9.11
func (em *EventMgr) PopFocus()
PopFocus pops off the focus stack and sets prev to current focus.
func (*EventMgr) PushFocus ¶ added in v0.9.11
PushFocus pushes current focus onto stack and sets new focus.
func (*EventMgr) ResetMouseDrag ¶ added in v0.9.11
func (em *EventMgr) ResetMouseDrag()
ResetMouseDrag resets all the mouse dragging variables after last drag
func (*EventMgr) ResetMouseMove ¶ added in v0.9.11
func (em *EventMgr) ResetMouseMove()
ResetMouseMove resets all the mouse moving variables after last move
func (*EventMgr) SendDNDDropEvent ¶ added in v0.9.11
SendDNDDropEvent sends DND drop event -- returns false if drop event was not processed in which case the event should be cleared (by the Window)
func (*EventMgr) SendDNDHoverEvent ¶ added in v0.9.11
SendDNDHoverEvent sends DND hover event, based on last mouse move event
func (*EventMgr) SendDNDMoveEvent ¶ added in v0.9.11
SendDNDMoveEvent sends DND move event
func (*EventMgr) SendEventSignal ¶ added in v0.9.11
SendEventSignal sends given event signal to all receivers that want it -- note that because there is a different EventSig for each event type, we are ONLY looking at nodes that have registered to receive that type of event -- the further filtering is just to ensure that they are in the right position to receive the event (focus, popup filtering, etc). If popup is true, then only items on popup are in scope, otherwise items NOT on popup are in scope (if no popup, everything is in scope).
func (*EventMgr) SendEventSignalFunc ¶ added in v0.9.11
func (em *EventMgr) SendEventSignalFunc(evi oswin.Event, popup bool, rvs *WinEventRecvList, recv ki.Ki, fun ki.RecvFunc) bool
SendEventSignalFunc is the inner loop of the SendEventSignal -- needed to deal with map iterator locking logic in a cleaner way. Returns true to continue, false to break
func (*EventMgr) SendHoverEvent ¶ added in v0.9.11
SendHoverEvent sends mouse hover event, based on last mouse move event
func (*EventMgr) SendKeyChordEvent ¶ added in v0.9.11
SendKeyChordEvent sends a KeyChord event with given values. If popup is true, then only items on popup are in scope, otherwise items NOT on popup are in scope (if no popup, everything is in scope).
func (*EventMgr) SendKeyFunEvent ¶ added in v0.9.11
SendKeyFunEvent sends a KeyChord event with params from the given KeyFun. If popup is true, then only items on popup are in scope, otherwise items NOT on popup are in scope (if no popup, everything is in scope).
func (*EventMgr) SendSig ¶ added in v0.9.11
SendSig directly calls SendSig from given recv, sender for given event across all priorities.
func (*EventMgr) SetFocus ¶ added in v0.9.11
SetFocus sets focus to given item -- returns true if focus changed. If item is nil, then nothing has focus.
func (*EventMgr) SetStartFocus ¶ added in v0.9.11
SetStartFocus sets the given item to be first focus when window opens.
type EventPris ¶
type EventPris int32
EventPris for different queues of event signals, processed in priority order
const ( // HiPri = high priority -- event receivers processed first -- can be used // to override default behavior HiPri EventPris = iota // RegPri = default regular priority -- most should be here RegPri // LowPri = low priority -- processed last -- typically for containers / // dialogs etc LowPri // LowRawPri = unfiltered (raw) low priority -- ignores whether the event // was already processed. LowRawPri EventPrisN // AllPris = -1 = all priorities (for delete cases only) AllPris EventPris = -1 )
func StringToEventPris ¶
type FavPathItem ¶
type FavPathItem struct { Ic IconName `desc:"icon for item"` Name string `width:"20" desc:"name of the favorite item"` Path string `tableview:"-select"` }
FavPathItem represents one item in a favorite path list, for display of favorites. Is an ordered list instead of a map because user can organize in order
func (FavPathItem) Label ¶
func (fi FavPathItem) Label() string
Label satisfies the Labeler interface
type FavPaths ¶
type FavPaths []FavPathItem
FavPaths is a list (slice) of favorite path items
func (*FavPaths) SetToDefaults ¶
func (pf *FavPaths) SetToDefaults()
SetToDefaults sets the paths to default values
type FileName ¶
type FileName string
FileName is used to specify an filename (including path) -- automatically opens the FileView dialog using ValueView system. Use this for any method args that are filenames to trigger use of FileViewDialog under MethView automatic method calling.
type FilePaths ¶
type FilePaths []string
var SavedPaths FilePaths
func (*FilePaths) AddPath ¶
AddPath inserts a path to the file paths (at the start), subject to max length -- if path is already on the list then it is moved to the start.
type FillRules ¶ added in v0.9.8
type FillRules int
func (*FillRules) FromString ¶ added in v0.9.8
func (FillRules) MarshalJSON ¶ added in v0.9.8
func (*FillRules) UnmarshalJSON ¶ added in v0.9.8
type FillStyle ¶
type FillStyle struct { On bool `desc:"is fill active -- if property is none then false"` Color ColorSpec `xml:"fill" desc:"prop: fill = fill color specification"` Opacity float32 `xml:"fill-opacity" desc:"prop: fill-opacity = global alpha opacity / transparency factor"` Rule FillRules `xml:"fill-rule" desc:"prop: fill-rule = rule for how to fill more complex shapes with crossing lines"` }
FillStyle contains all the properties for filling a region
func (*FillStyle) Defaults ¶
func (pf *FillStyle) Defaults()
Defaults initializes default values for paint fill
func (*FillStyle) SetColorSpec ¶
SetColorSpec sets full color spec from source
func (*FillStyle) SetStylePost ¶
SetStylePost does some updating after setting the style from user properties
type FocusChanges ¶
type FocusChanges int32
FocusChanges are the kinds of changes that can be reported via FocusChanged2D method
const ( // FocusLost means that keyboard focus is on a different widget // (typically) and this one lost focus FocusLost FocusChanges = iota // FocusGot means that this widget just got keyboard focus FocusGot // FocusInactive means that although this widget retains keyboard focus // (nobody else has it), the user has clicked on something else and // therefore the focus should be considered inactive (distracted), and any // changes should be applied as this other action could result in closing // of a dialog etc. Keyboard events will still be sent to the focus // widget, but it is up to the widget if or how to process them (e.g., it // could reactivate on its own). FocusInactive // FocusActive means that the user has moved the mouse back into the // focused widget to resume active keyboard focus. FocusActive FocusChangesN )
func (*FocusChanges) FromString ¶
func (i *FocusChanges) FromString(s string) error
func (FocusChanges) String ¶
func (i FocusChanges) String() string
type FontFace ¶ added in v0.9.8
type FontFace struct { Name string `desc:"The full FaceName that the font is accessed by"` Size int `desc:"The integer font size in raw dots"` Face font.Face `desc:"The system image.Font font rendering interface"` Metrics FontMetrics `desc:"enhanced metric information for the font"` }
FontFace is our enhanced Font Face structure which contains the enhanced computed metrics in addition to the font.Face face
func NewFontFace ¶ added in v0.9.8
NewFontFace returns a new font face
func OpenFontFace ¶
OpenFontFace loads a font file at given path, with given raw size in display dots, and if strokeWidth is > 0, the font is drawn in outline form (stroked) instead of filled (supported in SVG). loadFontMu must be locked prior to calling
func (*FontFace) ComputeMetrics ¶ added in v0.9.8
func (fs *FontFace) ComputeMetrics()
ComputeMetrics computes the Height, Em, Ex, Ch and Rem metrics associated with current font and overall units context
type FontInfo ¶
type FontInfo struct { Name string `desc:"official regularized name of font"` Stretch FontStretch `xml:"stretch" desc:"stretch: normal, expanded, condensed, etc"` Weight FontWeights `xml:"weight" desc:"weight: normal, bold, etc"` Style FontStyles `xml:"style" desc:"style -- normal, italic, etc"` Example string `desc:"example text -- styled according to font params in chooser"` }
FontInfo contains basic font information for choosing a given font -- displayed in the font chooser dialog.
type FontLib ¶
type FontLib struct { FontPaths []string `desc:"list of font paths to search for fonts"` FontsAvail map[string]string `desc:"map of font name to path to file"` FontInfo []FontInfo `desc:"information about each font -- this list should be used for selecting valid regularized font names"` Faces map[string]map[int]*FontFace `desc:"double-map of cached fonts, by font name and then integer font size within that"` }
FontLib holds the fonts available in a font library. The font name is regularized so that the base "Regular" font is the root term of a sequence of other font names that describe the stretch, weight, and style, e.g., "Arial" as the base name, "Arial Bold", "Arial Bold Italic" etc. Thus, each font name specifies a particular font weight and style. When fonts are loaded into the library, the names are appropriately regularized.
var FontLibrary FontLib
FontLibrary is the gi font library, initialized from fonts available on font paths
func (*FontLib) AddFontPaths ¶
func (*FontLib) DeleteFont ¶
DeleteFont removes given font from list of available fonts -- if not supported etc
func (*FontLib) Font ¶
Font gets a particular font, specified by the official regularized font name (see FontsAvail list), at given dots size (integer), using a cache of loaded fonts.
func (*FontLib) FontAvail ¶
FontAvail determines if a given font name is available (case insensitive)
func (*FontLib) FontsAvailFromPath ¶
FontsAvailFromPath scans for all fonts we can use on a given path, gathering info into FontsAvail and FontInfo.
func (*FontLib) GoFontsAvail ¶
func (fl *FontLib) GoFontsAvail()
func (*FontLib) Init ¶
func (fl *FontLib) Init()
Init initializes the font library if it hasn't been yet
func (*FontLib) InitFontPaths ¶
InitFontPaths initializes font paths to system defaults, only if no paths have yet been set
func (*FontLib) OpenAllFonts ¶
OpenAllFonts attempts to load all fonts that were found -- call this before displaying the font chooser to eliminate any bad fonts.
func (*FontLib) UpdateFontsAvail ¶
UpdateFontsAvail scans for all fonts we can use on the FontPaths
type FontMetrics ¶ added in v0.9.8
type FontMetrics struct { Height float32 `` /* 180-byte string literal not displayed */ Em float32 `` /* 242-byte string literal not displayed */ Ex float32 `desc:"Ex size of font -- this is the actual height of the letter x in the font"` Ch float32 `desc:"Ch size of font -- this is the actual width of the 0 glyph in the font"` }
FontMetrics are our enhanced dot-scale font metrics compared to what is available in the standard font.Metrics lib, including Ex and Ch being defined in terms of the actual letter x and 0
type FontName ¶
type FontName string
FontName is used to specify a font, as the unique name of the font family. This automatically provides a chooser menu for fonts using giv ValueView.
type FontStretch ¶
type FontStretch int32
FontStretch are different stretch levels of font. These are less typically available on most platforms by default.
const ( FontStrNormal FontStretch = iota FontStrUltraCondensed FontStrExtraCondensed FontStrSemiCondensed FontStrSemiExpanded FontStrExtraExpanded FontStrUltraExpanded FontStrCondensed FontStrExpanded FontStrNarrower FontStrWider FontStretchN )
func (*FontStretch) FromString ¶
func (i *FontStretch) FromString(s string) error
func (FontStretch) MarshalJSON ¶
func (ev FontStretch) MarshalJSON() ([]byte, error)
func (FontStretch) String ¶
func (i FontStretch) String() string
func (*FontStretch) UnmarshalJSON ¶
func (ev *FontStretch) UnmarshalJSON(b []byte) error
type FontStyle ¶
type FontStyle struct { Color Color `xml:"color" inherit:"true" desc:"prop: color (inherited) = text color -- also defines the currentColor variable value"` BgColor ColorSpec `xml:"background-color" desc:"prop: background-color = background color -- not inherited, transparent by default"` Opacity float32 `xml:"opacity" desc:"prop: opacity = alpha value to apply to all elements"` Size units.Value `` /* 135-byte string literal not displayed */ Family string `` /* 181-byte string literal not displayed */ Style FontStyles `xml:"font-style" inherit:"true" desc:"prop: font-style = style -- normal, italic, etc"` Weight FontWeights `xml:"font-weight" inherit:"true" desc:"prop: font-weight = weight: normal, bold, etc"` Stretch FontStretch `xml:"font-stretch" inherit:"true" desc:"prop: font-stretch = font stretch / condense options"` Variant FontVariants `xml:"font-variant" inherit:"true" desc:"prop: font-variant = normal or small caps"` Deco TextDecorations `xml:"text-decoration" desc:"prop: text-decoration = underline, line-through, etc -- not inherited"` Shift BaselineShifts `xml:"baseline-shift" desc:"prop: baseline-shift = super / sub script -- not inherited"` Face *FontFace `` /* 157-byte string literal not displayed */ Rem float32 `desc:"Rem size of font -- 12pt converted to same effective DPI as above measurements"` }
FontStyle contains all font styling information, including everything that is used in SVG text rendering -- used in Paint and in Style. Most of font information is inherited.
func (*FontStyle) ClearDeco ¶
func (fs *FontStyle) ClearDeco(deco TextDecorations)
ClearDeco clears decoration (underline, etc), which uses bitflag to allow multiple combinations
func (*FontStyle) CopyNonDefaultProps ¶ added in v0.9.11
CopyNonDefaultProps does SetProp on given node for all of the style settings that are not at their default values.
func (*FontStyle) FaceName ¶
FaceName returns the full FaceName to use for the current FontStyle spec, robustly
func (*FontStyle) InheritFields ¶
InheritFields from parent: Manual inheriting of values is much faster than automatic version!
func (*FontStyle) OpenFont ¶
OpenFont loads the font specified by the font style from the font library. This is the primary method to use for loading fonts, as it uses a robust fallback method to finding an appropriate font, and falls back on the builtin Go font as a last resort. The Face field will have the resulting font. The font size is always rounded to nearest integer, to produce better-looking results (presumably). The current metrics and given unit.Context are updated based on the properties of the font.
func (*FontStyle) SetDeco ¶
func (fs *FontStyle) SetDeco(deco TextDecorations)
SetDeco sets decoration (underline, etc), which uses bitflag to allow multiple combinations
func (*FontStyle) SetStylePost ¶
SetStylePost does any updates after generic xml-tag property setting -- use for anything that also has non-standard values that might not be processed properly by default
func (*FontStyle) SetStyleProps ¶
func (fs *FontStyle) SetStyleProps(parent *FontStyle, props ki.Props, vp *Viewport2D)
SetStyleProps sets font style values based on given property map (name: value pairs), inheriting elements as appropriate from parent, and also having a default style for the "initial" setting.
func (*FontStyle) SetUnitContext ¶
SetUnitContext sets the font-specific information in the given units.Context, based on the currently-loaded face.
func (*FontStyle) StyleCSS ¶
func (fs *FontStyle) StyleCSS(tag string, cssAgg ki.Props, ctxt *units.Context, vp *Viewport2D) bool
Style CSS looks for "tag" name props in cssAgg props, and applies those to style if found, and returns true -- false if no such tag found
func (*FontStyle) StyleFromProps ¶ added in v0.9.8
func (fs *FontStyle) StyleFromProps(par *FontStyle, props ki.Props, vp *Viewport2D)
type FontStyles ¶
type FontStyles int32
FontStyles styles of font: normal, italic, etc
const ( FontNormal FontStyles = iota FontItalic FontOblique FontStylesN )
func (*FontStyles) FromString ¶
func (i *FontStyles) FromString(s string) error
func (FontStyles) MarshalJSON ¶
func (ev FontStyles) MarshalJSON() ([]byte, error)
func (FontStyles) String ¶
func (i FontStyles) String() string
func (*FontStyles) UnmarshalJSON ¶
func (ev *FontStyles) UnmarshalJSON(b []byte) error
type FontVariants ¶
type FontVariants int32
FontVariants is just normal vs. small caps. todo: not currently supported
const ( FontVarNormal FontVariants = iota FontVarSmallCaps FontVariantsN )
func (*FontVariants) FromString ¶
func (i *FontVariants) FromString(s string) error
func (FontVariants) MarshalJSON ¶
func (ev FontVariants) MarshalJSON() ([]byte, error)
func (FontVariants) String ¶
func (i FontVariants) String() string
func (*FontVariants) UnmarshalJSON ¶
func (ev *FontVariants) UnmarshalJSON(b []byte) error
type FontWeights ¶
type FontWeights int32
FontWeights are the valid names for different weights of font, with both the numeric and standard names given. The regularized font names in the font library use the names, as those are typically found in the font files.
const ( WeightNormal FontWeights = iota Weight100 WeightThin // (Hairline) Weight200 WeightExtraLight // (UltraLight) Weight300 WeightLight Weight400 Weight500 WeightMedium Weight600 WeightSemiBold // (DemiBold) Weight700 WeightBold Weight800 WeightExtraBold // (UltraBold) Weight900 WeightBlack WeightBolder WeightLighter FontWeightsN )
func (*FontWeights) FromString ¶
func (i *FontWeights) FromString(s string) error
func (FontWeights) MarshalJSON ¶
func (ev FontWeights) MarshalJSON() ([]byte, error)
func (FontWeights) String ¶
func (i FontWeights) String() string
func (*FontWeights) UnmarshalJSON ¶
func (ev *FontWeights) UnmarshalJSON(b []byte) error
type Frame ¶
type Frame struct { Layout Stripes Stripes `desc:"options for striped backgrounds -- rendered as darker bands relative to background color"` }
Frame is a Layout that renders a background according to the background-color style setting, and optional striping for grid layouts
func AddNewFrame ¶ added in v0.9.7
AddNewFrame adds a new frame to given parent node, with given name and layout
func (*Frame) CopyFieldsFrom ¶ added in v0.9.8
func (fr *Frame) CopyFieldsFrom(frm interface{})
func (*Frame) FrameStdRender ¶
func (fr *Frame) FrameStdRender()
FrameStdRender does the standard rendering of the frame itself
func (*Frame) RenderStripes ¶
func (fr *Frame) RenderStripes()
type Geom2DInt ¶
Geom2DInt defines a geometry in 2D dots units (int) -- this is just a more convenient format than image.Rectangle for cases where the size and position are independently updated (e.g., Viewport)
type GoFontInfo ¶ added in v0.9.7
type GoFontInfo struct {
// contains filtered or unexported fields
}
type Gradient ¶
type Gradient struct { Node2DBase Grad ColorSpec `desc:"the color gradient"` }
Gradient is used for holding a specified color gradient -- name is id for lookup in url
func AddNewGradient ¶ added in v0.9.7
AddNewGradient adds a new gradient to given parent node, with given name.
func (*Gradient) CopyFieldsFrom ¶ added in v0.9.8
func (gr *Gradient) CopyFieldsFrom(frm interface{})
type GradientPoints ¶
type GradientPoints int32
GradientPoints defines points within the gradient
const ( GpX1 GradientPoints = iota GpY1 GpX2 GpY2 GradientPointsN )
type GridData ¶
type GridData struct { SizeNeed float32 SizePref float32 SizeMax float32 AllocSize float32 AllocPosRel float32 }
GridData contains data for grid layout -- only one value needed for relevant dim
type HSLA ¶
type HSLA struct {
H, S, L, A float32
}
HSLA represents the Hue [0..360], Saturation [0..1], and Luminance (lightness) [0..1] of the color using float32 values
type HiStyleName ¶ added in v0.9.11
type HiStyleName string
HiStyleName is a highlighting style name
type Icon ¶
type Icon struct { WidgetBase Filename string `desc:"file name for the loaded icon, if loaded"` }
Icon is a wrapper around a child svg.Icon SVG element. SVG should contain no color information -- it should just be a filled shape where the fill and stroke colors come from the surrounding context / paint settings. The rendered version is cached for a given size. Icons are always copied from an original source icon and then can be customized from there.
func AddNewIcon ¶ added in v0.9.7
AddNewIcon adds a new icon to given parent node, with given name, and icon name.
func (*Icon) CopyFieldsFrom ¶ added in v0.9.8
func (ic *Icon) CopyFieldsFrom(frm interface{})
func (*Icon) SVGIcon ¶
func (ic *Icon) SVGIcon() *Viewport2D
SVGIcon returns the child svg icon, or nil
func (*Icon) SetIcon ¶
SetIcon sets the icon by name into given Icon wrapper, returning error message if not found etc, and returning true if a new icon was actually set -- does nothing if UniqueNm is already == icon name and has children, and deletes children if name is nil / none (both cases return false for new icon)
type IconMgr ¶
type IconMgr interface { // IsValid checks if given icon name is a valid name for an available icon // (also checks that the icon manager is non-nil and issues appropriate error) IsValid(iconName string) bool // SetIcon sets the icon by name into given Icon wrapper, returning error // message if not found etc SetIcon(ic *Icon, iconName string) error // IconList returns the list of available icon names, optionally sorted // alphabetically (otherwise in map-random order) IconList(alphaSort bool) []IconName }
IconMgr is the manager of all things Icon -- needed to allow svg to be a separate package, and implemented by svg.IconMgr
var TheIconMgr IconMgr
TheIconMgr is set by loading the gi/svg package -- all final users must import github/goki/gi/svg to get its init function
type IconName ¶
type IconName string
IconName is used to specify an icon -- currently just the unique name of the icon -- automatically provides a chooser menu for icons using ValueView system
func (IconName) IsNil ¶
IsNil tests whether the icon name is empty, 'none' or 'nil' -- indicates to not use a icon
func (IconName) IsValid ¶
IsValid tests whether the icon name is valid -- represents a non-nil icon available in the current or default icon set
func (IconName) SetIcon ¶
SetIcon sets the icon by name into given Icon wrapper, returning error message if not found etc, and returning true if a new icon was actually set -- does nothing if UniqueNm is already == icon name and has children, and deletes children if name is nil / none (both cases return false for new icon)
type KeyFuns ¶
type KeyFuns int32
KeyFuns are functions that keyboard events can perform in the GUI -- seems possible to keep this flat and consistent across different contexts, as long as the functions can be appropriately reinterpreted for each context.
const ( KeyFunNil KeyFuns = iota KeyFunMoveUp KeyFunMoveDown KeyFunMoveRight KeyFunMoveLeft KeyFunPageUp KeyFunPageDown // KeyFunPageRight // KeyFunPageLeft KeyFunHome // start-of-line KeyFunEnd // end-of-line KeyFunDocHome // start-of-doc -- Control / Alt / Shift +Home KeyFunDocEnd // end-of-doc Control / Alt / Shift +End KeyFunWordRight KeyFunWordLeft KeyFunFocusNext // Tab KeyFunFocusPrev // Shift-Tab KeyFunEnter // Enter / return key -- has various special functions KeyFunAccept // Ctrl+Enter = accept any changes and close dialog / move to next KeyFunCancelSelect KeyFunSelectMode KeyFunSelectAll KeyFunAbort // KeyFunEditItem KeyFunCopy KeyFunCut KeyFunPaste KeyFunPasteHist // from history KeyFunBackspace KeyFunBackspaceWord KeyFunDelete KeyFunDeleteWord KeyFunKill KeyFunDuplicate KeyFunTranspose KeyFunTransposeWord KeyFunUndo KeyFunRedo KeyFunInsert KeyFunInsertAfter KeyFunZoomOut KeyFunZoomIn KeyFunPrefs KeyFunRefresh KeyFunRecenter // Ctrl+L in emacs KeyFunComplete KeyFunLookup KeyFunSearch // Ctrl+S in emacs -- more interactive type of search KeyFunFind // Command+F full-dialog find KeyFunReplace KeyFunJump // jump to line KeyFunHistPrev KeyFunHistNext KeyFunMenu // put focus on menu KeyFunWinFocusNext KeyFunWinClose KeyFunWinSnapshot KeyFunGoGiEditor // Below are menu specific functions -- use these as shortcuts for menu actions // allows uniqueness of mapping and easy customization of all key actions KeyFunMenuNew KeyFunMenuNewAlt1 // alternative version (e.g., shift) KeyFunMenuNewAlt2 // alternative version (e.g., alt) KeyFunMenuOpen KeyFunMenuOpenAlt1 // alternative version (e.g., shift) KeyFunMenuOpenAlt2 // alternative version (e.g., alt) KeyFunMenuSave KeyFunMenuSaveAs KeyFunMenuSaveAlt // another alt (e.g., alt) KeyFunMenuCloseAlt1 // alternative version (e.g., shift) KeyFunMenuCloseAlt2 // alternative version (e.g., alt) KeyFunsN )
func (*KeyFuns) FromString ¶
func (KeyFuns) MarshalJSON ¶
func (*KeyFuns) UnmarshalJSON ¶
type KeyMap ¶
KeyMap is a map between a key sequence (chord) and a specific KeyFun function. This mapping must be unique, in that each chord has unique KeyFun, but multiple chords can trigger the same function.
var ActiveKeyMap *KeyMap
ActiveKeyMap points to the active map -- users can set this to an alternative map in Prefs
func (*KeyMap) ChordForFun ¶
ChordForFun returns first key chord trigger for given KeyFun in map
func (*KeyMap) ShortcutForFun ¶
ShortcutForFun returns OS-specific formatted shortcut for first key chord trigger for given KeyFun in map
func (*KeyMap) ToSlice ¶
func (km *KeyMap) ToSlice() []KeyMapItem
ToSlice copies this keymap to a slice of KeyMapItem's
func (*KeyMap) Update ¶
func (km *KeyMap) Update(kmName KeyMapName)
Update ensures that the given keymap has at least one entry for every defined KeyFun, grabbing ones from the default map if not, and also eliminates any Nil entries which might reflect out-of-date functions
type KeyMapItem ¶
type KeyMapItem struct { Key key.Chord `desc:"the key chord that activates a function"` Fun KeyFuns `desc:"the function of that key"` }
KeyMapItem records one element of the key map -- used for organizing the map.
type KeyMapName ¶
type KeyMapName string
KeyMapName has an associated ValueView for selecting from the list of available key map names, for use in preferences etc.
var ActiveKeyMapName KeyMapName
ActiveKeyMapName is the name of the active keymap
type KeyMaps ¶
type KeyMaps []KeyMapsItem
KeyMaps is a list of KeyMap's -- users can edit these in Prefs -- to create a custom one, just duplicate an existing map, rename, and customize
var AvailKeyMaps KeyMaps
AvailKeyMaps is the current list of available keymaps for use -- can be loaded / saved / edited with preferences. This is set to StdKeyMaps at startup.
func (*KeyMaps) MapByName ¶
func (km *KeyMaps) MapByName(name KeyMapName) (*KeyMap, int, bool)
MapByName returns a keymap and index by name -- returns false and emits a message to stdout if not found
func (*KeyMaps) OpenPrefs ¶
OpenPrefs opens KeyMaps from GoGi standard prefs directory, using PrefsKeyMapsFileName
func (*KeyMaps) RevertToStd ¶
func (km *KeyMaps) RevertToStd()
RevertToStd reverts this map to using the StdKeyMaps that are compiled into the program and have all the lastest key functions bound to standard values.
type KeyMapsItem ¶
type KeyMapsItem struct { Name string `width:"20" desc:"name of keymap"` Desc string `desc:"description of keymap -- good idea to include source it was derived from"` Map KeyMap `` /* 127-byte string literal not displayed */ }
KeyMapsItem is an entry in a KeyMaps list
func (KeyMapsItem) Label ¶
func (km KeyMapsItem) Label() string
Label satisfies the Labeler interface
type Label ¶
type Label struct { WidgetBase Text string `xml:"text" desc:"label to display"` Selectable bool `` /* 146-byte string literal not displayed */ Redrawable bool `` /* 317-byte string literal not displayed */ LinkSig ki.Signal `` /* 176-byte string literal not displayed */ StateStyles [LabelStatesN]Style `copy:"-" json:"-" xml:"-" desc:"styles for different states of label"` Render TextRender `copy:"-" xml:"-" json:"-" desc:"render data for text label"` RenderPos mat32.Vec2 `` /* 151-byte string literal not displayed */ CurBgColor Color `` /* 178-byte string literal not displayed */ }
Label is a widget for rendering text labels -- supports full widget model including box rendering, and full HTML styling, including links -- LinkSig emits link with data of URL -- opens default browser if nobody receiving signal. The default white-space option is 'pre' -- set to 'normal' or other options to get word-wrapping etc.
func AddNewLabel ¶ added in v0.9.7
AddNewLabel adds a new label to given parent node, with given name and text.
func (*Label) ConnectEvents2D ¶
func (lb *Label) ConnectEvents2D()
func (*Label) CopyFieldsFrom ¶ added in v0.9.8
func (lb *Label) CopyFieldsFrom(frm interface{})
func (*Label) Disconnect ¶ added in v0.9.8
func (lb *Label) Disconnect()
func (*Label) GrabCurBgColor ¶
func (lb *Label) GrabCurBgColor()
func (*Label) HoverEvent ¶
func (lb *Label) HoverEvent()
func (*Label) LabelEvents ¶
func (lb *Label) LabelEvents()
func (*Label) LayoutLabel ¶
func (lb *Label) LayoutLabel()
func (*Label) MouseEvent ¶
func (lb *Label) MouseEvent()
func (*Label) MouseMoveEvent ¶
func (lb *Label) MouseMoveEvent()
func (*Label) OpenLink ¶
OpenLink opens given link, either by sending LinkSig signal if there are receivers, or by calling the TextLinkHandler if non-nil, or URLHandler if non-nil (which by default opens user's default browser via oswin/App.OpenURL())
func (*Label) SetStateStyle ¶
func (lb *Label) SetStateStyle()
SetStateStyle sets the style based on the inactive, selected flags
func (*Label) SetText ¶
SetText sets the text and updates the rendered version. Note: if there is already a label set, and no other larger updates are taking place, the new label may just illegibly overlay on top of the old one -- set Redrawable = true to fix this issue (it will redraw the background -- sampling from actual if none is set).
func (*Label) StyleLabel ¶
func (lb *Label) StyleLabel()
type LabelStates ¶
type LabelStates int32
LabelStates are mutually-exclusive label states -- determines appearance
const ( // normal active state LabelActive LabelStates = iota // inactive -- font is dimmed LabelInactive // selected -- background is selected color LabelSelected // total number of button states LabelStatesN )
func (*LabelStates) FromString ¶
func (i *LabelStates) FromString(s string) error
func (LabelStates) MarshalJSON ¶
func (ev LabelStates) MarshalJSON() ([]byte, error)
func (LabelStates) String ¶
func (i LabelStates) String() string
func (*LabelStates) UnmarshalJSON ¶
func (ev *LabelStates) UnmarshalJSON(b []byte) error
type Labeler ¶
type Labeler interface { // Label returns a GUI-appropriate label for item Label() string }
Labeler interface provides a GUI-appropriate label for an item, via a Label() string method. Use ToLabel converter to attempt to use this interface and then fall back on Stringer via kit.ToString conversion function.
type Layout ¶
type Layout struct { WidgetBase Lay Layouts `xml:"lay" desc:"type of layout to use"` Spacing units.Value `xml:"spacing" desc:"extra space to add between elements in the layout"` StackTop int `` /* 155-byte string literal not displayed */ ChildSize mat32.Vec2 `copy:"-" json:"-" xml:"-" desc:"total max size of children as laid out"` ExtraSize mat32.Vec2 `copy:"-" json:"-" xml:"-" desc:"extra size in each dim due to scrollbars we add"` HasScroll [2]bool `copy:"-" json:"-" xml:"-" desc:"whether scrollbar is used for given dim"` Scrolls [2]*ScrollBar `copy:"-" json:"-" xml:"-" desc:"scroll bars -- we fully manage them as needed"` GridSize image.Point `copy:"-" json:"-" xml:"-" desc:"computed size of a grid layout based on all the constraints -- computed during Size2D pass"` GridData [RowColN][]GridData `copy:"-" json:"-" xml:"-" desc:"grid data for rows in [0] and cols in [1]"` FlowBreaks []int `copy:"-" json:"-" xml:"-" desc:"line breaks for flow layout"` NeedsRedo bool `` /* 157-byte string literal not displayed */ FocusName string `copy:"-" json:"-" xml:"-" desc:"accumulated name to search for when keys are typed"` FocusNameTime time.Time `copy:"-" json:"-" xml:"-" desc:"time of last focus name event -- for timeout"` FocusNameLast ki.Ki `copy:"-" json:"-" xml:"-" desc:"last element focused on -- used as a starting point if name is the same"` ScrollsOff bool `` /* 142-byte string literal not displayed */ ScrollSig ki.Signal `` /* 211-byte string literal not displayed */ }
Layout is the primary node type responsible for organizing the sizes and positions of child widgets -- all arbitrary collections of widgets should generally be contained within a layout -- otherwise the parent widget must take over responsibility for positioning. The alignment is NOT inherited by default so must be specified per child, except that the parent alignment is used within the relevant dimension (e.g., horizontal-align for a LayoutHoriz layout, to determine left, right, center, justified). Layouts can automatically add scrollbars depending on the Overflow layout style.
var LayoutDefault Layout
LayoutDefault is default obj that can be used when property specifies "default"
func AddNewLayout ¶ added in v0.9.7
AddNewLayout adds a new layout to given parent node, with given name and layout
func (*Layout) AllocFromParent ¶
func (ly *Layout) AllocFromParent()
AllocFromParent: if we are not a child of a layout, then get allocation from a parent obj that has a layout size
func (*Layout) AsLayout2D ¶
func (*Layout) AutoScroll ¶
AutoScroll scrolls the layout based on mouse position, when appropriate (DND, menus)
func (*Layout) AutoScrollDim ¶
AutoScrollDim auto-scrolls along one dimension
func (*Layout) AvailSize ¶
AvailSize returns the total size avail to this layout -- typically AllocSize except for top-level layout which uses VpBBox in case less is avail
func (*Layout) 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 (*Layout) ChildWithFocus ¶
ChildWithFocus returns a direct child of this layout that either is the current window focus item, or contains that focus item (along with its index) -- nil, -1 if none.
func (*Layout) ChildrenBBox2D ¶
func (*Layout) ChildrenUpdateSizes ¶ added in v0.9.15
func (ly *Layout) ChildrenUpdateSizes()
ChildrenUpdateSizes calls UpdateSizes on all children -- layout must at least call this
func (*Layout) ComputeBBox2D ¶
func (*Layout) ConnectEvents2D ¶
func (ly *Layout) ConnectEvents2D()
func (*Layout) CopyFieldsFrom ¶ added in v0.9.8
func (ly *Layout) CopyFieldsFrom(frm interface{})
func (*Layout) DeactivateScroll ¶
DeactivateScroll turns off given scrollbar, without deleting, so it can be easily re-used
func (*Layout) DeleteScroll ¶
DeleteScroll deletes scrollbar along given dimesion. todo: we are leaking the scrollbars -- move into a container Field
func (*Layout) FinalizeLayout ¶
func (ly *Layout) FinalizeLayout()
FinalizeLayout is final pass through children to finalize the layout, computing summary size stats
func (*Layout) FocusNextChild ¶
FocusNextChild attempts to move the focus into the next layout child (with wraparound to start) -- returns true if successful
func (*Layout) FocusOnName ¶
func (ly *Layout) FocusOnName(kt *key.ChordEvent) bool
FocusOnName processes key events to look for an element starting with given name
func (*Layout) FocusPrevChild ¶
FocusPrevChild attempts to move the focus into the previous layout child (with wraparound to end) -- returns true if successful
func (*Layout) GatherSizes ¶
func (ly *Layout) GatherSizes()
GatherSizes is size first pass: gather the size information from the children
func (*Layout) GatherSizesFlow ¶ added in v0.9.15
GatherSizesFlow is size first pass: gather the size information from the children
func (*Layout) GatherSizesGrid ¶
func (ly *Layout) GatherSizesGrid()
GatherSizesGrid is size first pass: gather the size information from the children, grid version
func (*Layout) GatherSizesSumMax ¶ added in v0.9.15
GatherSizesSumMax gets basic sum and max data across all kiddos
func (*Layout) HasAnyScroll ¶
HasAnyScroll returns true if layout has
func (*Layout) HasFocus2D ¶
func (*Layout) KeyChordEvent ¶
func (ly *Layout) KeyChordEvent()
KeyChordEvent processes (lowpri) layout key events
func (*Layout) LayoutAlongDim ¶
LayoutAlongDim lays out all children along given dim -- only affects that dim -- e.g., use LayoutSharedDim for other dim.
func (*Layout) LayoutFlow ¶ added in v0.9.15
LayoutFlow manages the flow layout along given dimension returns true if needs another iteration (only if iter == 0)
func (*Layout) LayoutGrid ¶
func (ly *Layout) LayoutGrid()
LayoutGrid manages overall grid layout of children
func (*Layout) LayoutGridDim ¶
LayoutGridDim lays out grid data along each dimension (row, Y; col, X), same as LayoutAlongDim. For cols, X has width prefs of each -- turn that into an actual allocated width for each column, and likewise for rows.
func (*Layout) LayoutKeys ¶
func (ly *Layout) LayoutKeys(kt *key.ChordEvent)
LayoutKeys is key processing for layouts -- focus name and arrow keys
func (*Layout) LayoutScrollEvents ¶
func (ly *Layout) LayoutScrollEvents()
LayoutScrollEvents registers scrolling-related mouse events processed by Layout -- most subclasses of Layout will want these..
func (*Layout) LayoutSharedDim ¶
LayoutSharedDim lays out items along a shared dimension, where all elements share the same space, e.g., Horiz for a Vert layout, and vice-versa.
func (*Layout) LayoutSharedDimImpl ¶
func (ly *Layout) LayoutSharedDimImpl(avail, need, pref, max, spc float32, al Align) (pos, size float32)
LayoutSharedDim implements calculations to layout for the shared dimension (i.e., Vertical for Horizontal layout). Returns pos and size.
func (*Layout) ManageOverflow ¶
func (ly *Layout) ManageOverflow()
ManageOverflow processes any overflow according to overflow settings.
func (*Layout) Move2DChildren ¶
func (*Layout) Move2DDelta ¶
we add our own offset here
func (*Layout) Move2DScrolls ¶
Move2DScrolls moves scrollbars based on scrolling taking place in parent layouts -- critical to call this BEFORE we add our own delta, which is generated from these very same scrollbars.
func (*Layout) ReRenderScrolls ¶
func (ly *Layout) ReRenderScrolls()
ReRenderScrolls re-draws the scrollbars de-novo -- can be called ad-hoc by others
func (*Layout) ScrollActionDelta ¶ added in v0.9.11
ScrollActionDelta moves the scrollbar in given dimension by given delta and emits a ScrollSig signal.
func (*Layout) ScrollActionPos ¶ added in v0.9.11
ScrollActionPos moves the scrollbar in given dimension to given position and emits a ScrollSig signal.
func (*Layout) ScrollDelta ¶
func (ly *Layout) ScrollDelta(me *mouse.ScrollEvent)
ScrollDelta processes a scroll event. If only one dimension is processed, and there is a non-zero in other, then the consumed dimension is reset to 0 and the event is left unprocessed, so a higher level can consume the remainder.
func (*Layout) ScrollDimToCenter ¶
ScrollDimToCenter scrolls to put the given child coordinate position (eg., middle of a view box) at the center of our scroll area, to the extent possible -- returns true if scrolling was needed.
func (*Layout) ScrollDimToEnd ¶
ScrollDimToEnd scrolls to put the given child coordinate position (eg., bottom / right of a view box) at the end (bottom / right) of our scroll area, to the extent possible -- returns true if scrolling was needed.
func (*Layout) ScrollDimToStart ¶
ScrollDimToStart scrolls to put the given child coordinate position (eg., top / left of a view box) at the start (top / left) of our scroll area, to the extent possible -- returns true if scrolling was needed.
func (*Layout) ScrollToBox ¶
ScrollToBox scrolls the layout to ensure that given rect box is in view -- returns true if scrolling was needed
func (*Layout) ScrollToBoxDim ¶
ScrollToBoxDim scrolls to ensure that given rect box along one dimension is in view -- returns true if scrolling was needed
func (*Layout) ScrollToItem ¶
ScrollToItem scrolls the layout to ensure that given item is in view -- returns true if scrolling was needed
func (*Layout) ScrollToPos ¶ added in v0.9.11
ScrollToPos moves the scrollbar in given dimension to given position and DOES NOT emit a ScrollSig signal.
func (*Layout) SetScrollsOff ¶
func (ly *Layout) SetScrollsOff()
SetScrollsOff turns off the scrolls -- e.g., when layout is not visible
func (*Layout) StyleFromProps ¶ added in v0.9.8
func (ly *Layout) StyleFromProps(props ki.Props, vp *Viewport2D)
StyleFromProps styles Layout-specific fields from ki.Prop properties doesn't support inherit or default
func (*Layout) StyleLayout ¶
func (ly *Layout) StyleLayout()
func (*Layout) StyleToDots ¶ added in v0.9.8
ToDots runs ToDots on unit values, to compile down to raw pixels
type LayoutAllocs ¶ added in v0.9.16
type LayoutAllocs struct { Size mat32.Vec2 `` /* 170-byte string literal not displayed */ Pos mat32.Vec2 `desc:"position of this item, computed by adding in the PosRel to parent position"` PosRel mat32.Vec2 `desc:"allocated relative position of this item, computed by the parent layout"` SizeOrig mat32.Vec2 `` /* 209-byte string literal not displayed */ PosOrig mat32.Vec2 `` /* 134-byte string literal not displayed */ }
LayoutAllocs contains all the the layout allocations: size, position. These are set by the parent Layout during the Layout process.
func (*LayoutAllocs) Reset ¶ added in v0.9.16
func (la *LayoutAllocs) Reset()
Reset is called at start of layout process -- resets all values back to 0
type LayoutState ¶ added in v0.9.16
type LayoutState struct { Size SizePrefs `` /* 151-byte string literal not displayed */ Alloc LayoutAllocs `desc:"allocated size and position -- set by parent Layout"` }
LayoutState contains all the state needed to specify the layout of an item within a Layout. Is initialized with computed values of style prefs.
func (*LayoutState) Defaults ¶ added in v0.9.16
func (ld *LayoutState) Defaults()
func (*LayoutState) Reset ¶ added in v0.9.16
func (ld *LayoutState) Reset()
Reset is called at start of layout process -- resets all values back to 0
func (*LayoutState) SetFromStyle ¶ added in v0.9.16
func (ld *LayoutState) SetFromStyle(ls *LayoutStyle)
func (*LayoutState) SizePrefOrMax ¶ added in v0.9.16
func (ld *LayoutState) SizePrefOrMax() mat32.Vec2
SizePrefOrMax returns the pref size if non-zero, else the max-size -- use for style-based constraints during initial sizing (e.g., word wrapping)
func (*LayoutState) UpdateSizes ¶ added in v0.9.16
func (ld *LayoutState) UpdateSizes()
UpdateSizes updates our sizes based on AllocSize and Max constraints, etc
type LayoutStyle ¶
type LayoutStyle struct { ZIndex int `` /* 146-byte string literal not displayed */ AlignH Align `` /* 128-byte string literal not displayed */ AlignV Align `xml:"vertical-align" desc:"prop: vertical-align = vertical alignment -- for widget layouts -- not a standard css property"` PosX units.Value `xml:"x" desc:"prop: x = horizontal position -- often superseded by layout but otherwise used"` PosY units.Value `xml:"y" desc:"prop: y = vertical position -- often superseded by layout but otherwise used"` Width units.Value `xml:"width" desc:"prop: width = specified size of element -- 0 if not specified"` Height units.Value `xml:"height" desc:"prop: height = specified size of element -- 0 if not specified"` MaxWidth units.Value `` /* 132-byte string literal not displayed */ MaxHeight units.Value `` /* 133-byte string literal not displayed */ MinWidth units.Value `xml:"min-width" desc:"prop: min-width = specified minimum size of element -- 0 if not specified"` MinHeight units.Value `xml:"min-height" desc:"prop: min-height = specified minimum size of element -- 0 if not specified"` Margin units.Value `xml:"margin" desc:"prop: margin = outer-most transparent space around box element -- todo: can be specified per side"` Padding units.Value `` /* 201-byte string literal not displayed */ Overflow Overflow `` /* 164-byte string literal not displayed */ Columns int `` /* 194-byte string literal not displayed */ Row int `xml:"row" desc:"prop: row = specifies the row that this element should appear within a grid layout"` Col int `xml:"col" desc:"prop: col = specifies the column that this element should appear within a grid layout"` RowSpan int `` /* 163-byte string literal not displayed */ ColSpan int `` /* 134-byte string literal not displayed */ ScrollBarWidth units.Value `xml:"scrollbar-width" desc:"prop: scrollbar-width = width of a layout scrollbar"` }
LayoutStyle contains style preferences on the layout of the element.
func (*LayoutStyle) AlignDim ¶
func (ls *LayoutStyle) AlignDim(d mat32.Dims) Align
return the alignment for given dimension
func (*LayoutStyle) Defaults ¶
func (ls *LayoutStyle) Defaults()
func (*LayoutStyle) MaxSizeDots ¶
func (ls *LayoutStyle) MaxSizeDots() mat32.Vec2
size max settings, in dots
func (*LayoutStyle) MinSizeDots ¶
func (ls *LayoutStyle) MinSizeDots() mat32.Vec2
size min settings, in dots
func (*LayoutStyle) PosDots ¶
func (ls *LayoutStyle) PosDots() mat32.Vec2
position settings, in dots
func (*LayoutStyle) SetStylePost ¶
func (ls *LayoutStyle) SetStylePost(props ki.Props)
func (*LayoutStyle) ToDots ¶ added in v0.9.8
func (ly *LayoutStyle) ToDots(uc *units.Context)
ToDots runs ToDots on unit values, to compile down to raw pixels
type Layouts ¶
type Layouts int32
Layouts are the different types of layouts
const ( // LayoutHoriz arranges items horizontally across a row LayoutHoriz Layouts = iota // LayoutVert arranges items vertically in a column LayoutVert // LayoutGrid arranges items according to a regular grid LayoutGrid // LayoutHorizFlow arranges items horizontally across a row, overflowing // vertically as needed. Ballpark target width or height props should be set // to generate initial first-pass sizing estimates. LayoutHorizFlow // LayoutVertFlow arranges items vertically within a column, overflowing // horizontally as needed. Ballpark target width or height props should be set // to generate initial first-pass sizing estimates. LayoutVertFlow // LayoutStacked arranges items stacked on top of each other -- Top index // indicates which to show -- overall size accommodates largest in each // dimension LayoutStacked // LayoutNil is a nil layout -- doesn't do anything -- for cases when a // parent wants to take over the job of the layout LayoutNil LayoutsN )
func (*Layouts) FromString ¶
func (Layouts) MarshalJSON ¶
func (*Layouts) UnmarshalJSON ¶
type LineCaps ¶ added in v0.9.8
type LineCaps int
end-cap of a line: stroke-linecap property in SVG
func (*LineCaps) FromString ¶ added in v0.9.8
func (LineCaps) MarshalJSON ¶ added in v0.9.8
func (*LineCaps) UnmarshalJSON ¶ added in v0.9.8
type LineJoins ¶ added in v0.9.8
type LineJoins int
the way in which lines are joined together: stroke-linejoin property in SVG
func (*LineJoins) FromString ¶ added in v0.9.8
func (LineJoins) MarshalJSON ¶ added in v0.9.8
func (*LineJoins) UnmarshalJSON ¶ added in v0.9.8
type MakeMenuFunc ¶
MakeMenuFunc is a callback for making a menu on demand, receives the object calling this function (typically an Action or Button) and the menu
type Menu ¶
Menu is a slice list of Node2D actions, which can contain sub-actions (though it can contain anything -- it is just added to a column layout and displayed in a popup) -- don't use stretchy sizes in general for these items!
func (*Menu) AddAction ¶
AddAction adds an action to the menu using given options, and connects the action signal to given receiver object and function, along with given data which is stored on the action and then passed in the action signal. Optional updateFunc is a function called prior to showing the menu to update the actions (enabled or not typically).
func (*Menu) AddAppMenu ¶
AddAppMenu adds an "app" menu to the menu -- calls AddStdAppMenu and then CustomAppMenuFunc if non-nil
func (*Menu) AddCopyCutPaste ¶
AddCopyCutPaste adds a Copy, Cut, Paste actions that just emit the corresponding keyboard shortcut. Paste is automatically enabled by clipboard having something in it.
func (*Menu) AddCopyCutPasteDupe ¶
AddCopyCutPasteDupe adds a Copy, Cut, Paste, and Duplicate actions that just emit the corresponding keyboard shortcut. Paste is automatically enabled by clipboard having something in it.
func (*Menu) AddSeparator ¶
AddSeparator adds a separator at the next point in the menu (name is just internal label of element, defaults to 'sep' if empty)
func (*Menu) AddStdAppMenu ¶
AddStdAppMenu adds a standard set of menu items for application-level control.
func (*Menu) AddWindowsMenu ¶
AddWindowsMenu adds menu items for current main and dialog windows. must be called under WindowGlobalMu mutex lock!
func (*Menu) DeleteShortcuts ¶ added in v0.9.14
DeleteShortcuts deletes the shortcuts in given window
func (*Menu) FindActionByName ¶
FindActionByName finds an action on the menu, or any sub-menu, with given name (exact match) -- this is not the Text label but the Name of the element (for AddAction items, this is the same as Label or Icon (if Label is empty)) -- returns false if not found
func (*Menu) InsertActionAfter ¶
InsertActionAfter adds an action to the menu after existing item of given name, using given options, and connects the action signal to given receiver object and function, along with given data which is stored on the action and then passed in the action signal. Optional updateFunc is a function called prior to showing the menu to update the actions (enabled or not typically). If name not found, adds to end of list..
func (*Menu) InsertActionBefore ¶
func (m *Menu) InsertActionBefore(before string, opts ActOpts, sigTo ki.Ki, fun ki.RecvFunc) *Action
InsertActionBefore adds an action to the menu before existing item of given name, using given options, and connects the action signal to given receiver object and function, along with given data which is stored on the action and then passed in the action signal. Optional updateFunc is a function called prior to showing the menu to update the actions (enabled or not typically). If name not found, adds to end of list..
func (Menu) MarshalJSON ¶
func (*Menu) SetShortcuts ¶
SetShortcuts sets the shortcuts to given window -- call when the menu has been attached to a window
func (*Menu) UnmarshalJSON ¶
func (*Menu) UpdateActions ¶
func (m *Menu) UpdateActions()
UpdateActions calls update function on all the actions in the menu, and any of their sub-actions
type MenuBar ¶
type MenuBar struct { Layout MainMenu bool `desc:"is this the main menu bar for a window? controls whether displayed on macOS"` OSMainMenus map[string]*Action `json:"-" xml:"-" desc:"map of main menu items for callback from OS main menu (MacOS specific)"` }
MenuBar is a Layout (typically LayoutHoriz) that renders a gradient background and has convenience methods for adding menus.
func AddNewMenuBar ¶ added in v0.9.7
AddNewMenuBar adds a new menubar to given parent node, with given name.
func (*MenuBar) ConfigMenus ¶
ConfigMenus configures Action items as children of MenuBar with the given names, which function as the main menu panels for the menu bar (File, Edit, etc). Access the resulting menus as .ChildByName("name").(*Action).
func (*MenuBar) CopyFieldsFrom ¶ added in v0.9.8
func (mb *MenuBar) CopyFieldsFrom(frm interface{})
func (*MenuBar) DeleteShortcuts ¶ added in v0.9.14
func (mb *MenuBar) DeleteShortcuts()
DeleteShortcuts deletes the shortcuts -- called when destroyed
func (*MenuBar) FindActionByName ¶
FindActionByName finds an action on the menu, or any sub-menu, with given name (exact match) -- this is not the Text label but the Name of the element (for AddAction items, this is the same as Label or Icon (if Label is empty)) -- returns false if not found
func (*MenuBar) MainMenuUpdateActives ¶
MainMenuUpdateActives updates the active state of all menu items, based on active state of corresponding Actions (action self-update functions are called via UpdateActions) -- can be called by method of same name on Window.
func (*MenuBar) MenuBarStdRender ¶
func (mb *MenuBar) MenuBarStdRender()
MenuBarStdRender does the standard rendering of the bar
func (*MenuBar) SetMainMenu ¶
SetMainMenu sets this menu as the current OS-specific, separate main menu for given window -- only should be called in window.Focus event. Does nothing if menu is empty.
func (*MenuBar) SetMainMenuSub ¶
SetMainMenuSub iterates over sub-menus, adding items to overall main menu.
func (*MenuBar) SetShortcuts ¶ added in v0.9.14
func (mb *MenuBar) SetShortcuts()
SetShortcuts sets the shortcuts to window associated with Toolbar Called in ConnectEvents2D()
func (*MenuBar) ShowMenuBar ¶
func (*MenuBar) UpdateActions ¶
func (mb *MenuBar) UpdateActions()
UpdateActions calls UpdateFunc on all actions in menu -- individual menus are automatically updated just prior to menu popup
func (*MenuBar) UpdateMainMenu ¶
UpdateMainMenu updates the OS-specific, separate main menu of given window based on this MenuBar -- called by Window.MainMenuUpdated.
type MenuButton ¶
type MenuButton struct {
ButtonBase
}
func AddNewMenuButton ¶ added in v0.9.7
func AddNewMenuButton(parent ki.Ki, name string) *MenuButton
AddNewMenuButton adds a new button to given parent node, with given name.
func (*MenuButton) ConfigParts ¶
func (mb *MenuButton) ConfigParts()
func (*MenuButton) CopyFieldsFrom ¶ added in v0.9.8
func (mb *MenuButton) CopyFieldsFrom(frm interface{})
type MetaData2D ¶
type MetaData2D struct { Node2DBase MetaData string }
MetaData2D is used for holding meta data info
func (*MetaData2D) CopyFieldsFrom ¶ added in v0.9.8
func (g *MetaData2D) CopyFieldsFrom(frm interface{})
type NRGBAf32 ¶
type NRGBAf32 struct {
R, G, B, A float32
}
NRGBAf32 stores non-alpha-premultiplied RGBA values in float32 0..1 normalized format -- more useful for converting to other spaces
type Node ¶ added in v0.9.9
type Node interface { // nodes are Ki elements -- this comes for free by embedding ki.Node in NodeBase ki.Ki // AsGiNode returns a generic gi.NodeBase for our node -- gives generic // access to all the base-level data structures without requiring // interface methods. AsGiNode() *NodeBase }
Node is the interface for all GoGi nodes (2D and 3D), for accessing as NodeBase
type Node2D ¶
type Node2D interface { Node // AsNode2D returns a generic Node2DBase for our node -- gives generic // access to all the base-level data structures without requiring // interface methods. AsNode2D() *Node2DBase // AsViewport2D returns Viewport2D if this node is one (has its own // bitmap, used for menus, dialogs, icons, etc), else nil. AsViewport2D() *Viewport2D // AsLayout2D returns Layout if this is a Layout-derived node, else nil AsLayout2D() *Layout // AsWidget returns WidgetBase if this is a WidgetBase-derived node, else nil. AsWidget() *WidgetBase // Init2D initializes a node -- grabs active Viewport etc -- must call // InitNodeBase as first step set basic inits including setting Viewport // -- all code here must be robust to being called repeatedly. Init2D() // Style2D: In a MeFirst downward pass, all properties are cached out in // an inherited manner, and incorporating any css styles, into either the // Paint or Style object for each Node, depending on the type of node (SVG // does Paint, Widget does Style). Only done once after structural // changes -- styles are not for dynamic changes. Style2D() // Size2D: MeLast downward pass, each node first calls // g.Layout.Reset(), then sets their LayoutSize according to their own // intrinsic size parameters, and/or those of its children if it is a // Layout. Size2D(iter int) // Layout2D: MeFirst downward pass (each node calls on its children at // appropriate point) with relevant parent BBox that the children are // constrained to render within -- they then intersect this BBox with // their own BBox (from BBox2D) -- typically just call Layout2DBase for // default behavior -- and add parent position to AllocPos, and then // return call to Layout2DChildren. Layout does all its sizing and // positioning of children in this pass, based on the Size2D data gathered // bottom-up and constraints applied top-down from higher levels. // Typically only a single iteration is required (iter = 0) but multiple // are supported (needed for word-wrapped text or flow layouts) -- return // = true indicates another iteration required (pass this up the chain). Layout2D(parBBox image.Rectangle, iter int) bool // Move2D: optional MeFirst downward pass to move all elements by given // delta -- used for scrolling -- the layout pass assigns canonical // positions, saved in AllocPosOrig and BBox, and this adds the given // delta to that AllocPosOrig -- each node must call ComputeBBox2D to // update its bounding box information given the new position. Move2D(delta image.Point, parBBox image.Rectangle) // BBox2D: compute the raw bounding box of this node relative to its // parent viewport -- called during Layout2D to set node BBox field, which // is then used in setting WinBBox and VpBBox. BBox2D() image.Rectangle // Compute VpBBox and WinBBox from BBox, given parent VpBBox -- most nodes // call ComputeBBox2DBase but viewports require special code -- called // during Layout and Move. ComputeBBox2D(parBBox image.Rectangle, delta image.Point) // ChildrenBBox2D: compute the bbox available to my children (content), // adjusting for margins, border, padding (BoxSpace) taken up by me -- // operates on the existing VpBBox for this node -- this is what is passed // down as parBBox do the children's Layout2D. ChildrenBBox2D() image.Rectangle // Render2D: Final rendering pass, each node is fully responsible for // calling Render2D on its own children, to provide maximum flexibility // (see Render2DChildren for default impl) -- bracket the render calls in // PushBounds / PopBounds and a false from PushBounds indicates that // VpBBox is empty and no rendering should occur. Typically call // ConnectEvents2D to set up connections to receive window events if // visible, and disconnect if not. Render2D() // ConnectEvents2D: setup connections to window events -- called in // Render2D if in bounds. It can be useful to create modular methods for // different event types that can then be mix-and-matched in any more // specialized types. ConnectEvents2D() // FocusChanged2D is called on node for changes in focus -- see the // FocusChanges values. FocusChanged2D(change FocusChanges) // HasFocus2D returns true if this node has keyboard focus and should // receive keyboard events -- typically this just returns HasFocus based // on the Window-managed HasFocus flag, but some types may want to monitor // all keyboard activity for certain key keys.. HasFocus2D() bool // FindNamedElement searches for given named element in this node or in // parent nodes. Used for url(#name) references. FindNamedElement(name string) Node2D // MakeContextMenu creates the context menu items (typically Action // elements, but it can be anything) for a given widget, typically // activated by the right mouse button or equivalent. Widget has a // function parameter that can be set to add context items (e.g., by Views // or other complex widgets) to extend functionality. MakeContextMenu(menu *Menu) // ContextMenuPos returns the default position for popup menus -- // by default in the middle of the WinBBox, but can be adapted as // appropriate for different widgets. ContextMenuPos() image.Point // ContextMenu displays the context menu of various actions to perform on // a node -- returns immediately, and actions are all executed directly // (later) via the action signals. Calls MakeContextMenu and // ContextMenuPos. ContextMenu() // IsVisible provides the definitive answer as to whether a given node // is currently visible. It is only entirely valid after a render pass // for widgets in a visible window, but it checks the window and viewport // for their visibility status as well, which is available always. // This does *not* check for VpBBox level visibility, which is a further check. // Non-visible nodes are automatically not rendered and not connected to // window events. The Invisible flag is one key element of the IsVisible // calculus -- it is set by e.g., TabView for invisible tabs, and is also // set if a widget is entirely out of render range. But again, use // IsVisible as the main end-user method. // For robustness, it recursively calls the parent -- this is typically // a short path -- propagating the Invisible flag properly can be // very challenging without mistakenly overwriting invisibility at various // levels. IsVisible() bool // IsDirectWinUpload returns true if this is a node that does a direct window upload // e.g., for gi3d.Scene which renders directly to the window texture for maximum efficiency IsDirectWinUpload() bool // DirectWinUpload does a direct upload of contents to the window // Called at the appropriate point during the overall window publish update process // For e.g., gi3d.Scene which renders directly to the window texture for maximum efficiency // Returns true if this is a type of node that does this (even if it didn't do it) DirectWinUpload() bool }
Node2D is the interface for all 2D nodes -- defines the stages of building and rendering the 2D scenegraph
type Node2DBase ¶
type Node2DBase struct { NodeBase Viewport *Viewport2D `copy:"-" json:"-" xml:"-" view:"-" desc:"our viewport -- set in Init2D (Base typically) and used thereafter"` }
Base struct node for 2D rendering tree -- renders to a bitmap using Paint rendering functions operating on the RenderState in the parent Viewport
For Widget / Layout nodes, rendering is done in 5 separate passes:
Init2D: In a MeFirst downward pass, Viewport pointer is set, styles are initialized, and any other widget-specific init is done.
Style2D: In a MeFirst downward pass, all properties are cached out in an inherited manner, and incorporating any css styles, into either the Paint (SVG) or Style (Widget) object for each Node. Only done once after structural changes -- styles are not for dynamic changes.
Size2D: MeLast downward pass, each node first calls g.Layout.Reset(), then sets their LayoutSize according to their own intrinsic size parameters, and/or those of its children if it is a Layout.
Layout2D: MeFirst downward pass (each node calls on its children at appropriate point) with relevant parent BBox that the children are constrained to render within -- they then intersect this BBox with their own BBox (from BBox2D) -- typically just call Layout2DBase for default behavior -- and add parent position to AllocPos. Layout does all its sizing and positioning of children in this pass, based on the Size2D data gathered bottom-up and constraints applied top-down from higher levels. Typically only a single iteration is required but multiple are supported (needed for word-wrapped text or flow layouts).
Render2D: Final rendering pass, each node is fully responsible for rendering its own children, to provide maximum flexibility (see Render2DChildren) -- bracket the render calls in PushBounds / PopBounds and a false from PushBounds indicates that VpBBox is empty and no rendering should occur. Nodes typically connect / disconnect to receive events from the window based on this visibility here.
* Move2D: optional pass invoked by scrollbars to move elements relative to their previously-assigned positions.
* SVG nodes skip the Size and Layout passes, and render directly into parent SVG viewport
func KiToNode2DBase ¶
func KiToNode2DBase(k ki.Ki) *Node2DBase
KiToNode2DBase converts Ki to a *Node2DBase -- use when known to be at least of this type, not-nil, etc
func (*Node2DBase) AsLayout2D ¶
func (nb *Node2DBase) AsLayout2D() *Layout
func (*Node2DBase) AsNode2D ¶
func (nb *Node2DBase) AsNode2D() *Node2DBase
func (*Node2DBase) AsViewport2D ¶
func (nb *Node2DBase) AsViewport2D() *Viewport2D
func (*Node2DBase) AsWidget ¶
func (nb *Node2DBase) AsWidget() *WidgetBase
func (*Node2DBase) BBox2D ¶
func (nb *Node2DBase) BBox2D() image.Rectangle
func (*Node2DBase) BBoxReport ¶
func (nb *Node2DBase) BBoxReport() string
BBoxReport reports on all the bboxes for everything in the tree
func (*Node2DBase) BaseIface ¶ added in v0.9.4
func (n *Node2DBase) BaseIface() reflect.Type
func (*Node2DBase) ChildrenBBox2D ¶
func (nb *Node2DBase) ChildrenBBox2D() image.Rectangle
func (*Node2DBase) ComputeBBox2D ¶
func (nb *Node2DBase) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)
func (*Node2DBase) ComputeBBox2DBase ¶
func (nb *Node2DBase) ComputeBBox2DBase(parBBox image.Rectangle, delta image.Point)
ComputeBBox2DBase -- computes the VpBBox and WinBBox from BBox, with whatever delta may be in effect
func (*Node2DBase) ConnectEvent ¶
ConnectEvent connects this node to receive a given type of GUI event signal from the parent window -- typically connect only visible nodes, and disconnect when not visible
func (*Node2DBase) ConnectEvents2D ¶
func (nb *Node2DBase) ConnectEvents2D()
func (*Node2DBase) ConnectToViewport ¶
func (nb *Node2DBase) ConnectToViewport()
ConnectToViewport connects the node's update signal to the viewport as a receiver, so that when the node is updated, it triggers the viewport to re-render it -- this is automatically called in PushBounds, and disconnected with DisconnectAllEvents, so it only occurs for rendered nodes.
func (*Node2DBase) ContainsFocus ¶
func (nb *Node2DBase) ContainsFocus() bool
ContainsFocus returns true if this widget contains the current focus widget as maintained in the Window
func (*Node2DBase) ContextMenu ¶
func (nb *Node2DBase) ContextMenu()
func (*Node2DBase) ContextMenuPos ¶
func (nb *Node2DBase) ContextMenuPos() (pos image.Point)
func (*Node2DBase) CopyFieldsFrom ¶ added in v0.9.8
func (nb *Node2DBase) CopyFieldsFrom(frm interface{})
func (*Node2DBase) DirectWinUpload ¶ added in v0.9.8
func (nb *Node2DBase) DirectWinUpload() bool
func (*Node2DBase) DisconnectAllEvents ¶
func (nb *Node2DBase) DisconnectAllEvents(pri EventPris)
DisconnectAllEvents disconnects node from all window events -- typically disconnect when not visible -- pri is priority -- pass AllPris for all priorities. This goes down the entire tree from this node on down, as typically everything under will not get an explicit disconnect call because no further updating will happen
func (*Node2DBase) DisconnectEvent ¶
func (nb *Node2DBase) DisconnectEvent(et oswin.EventType, pri EventPris)
DisconnectEvent disconnects this receiver from receiving given event type -- pri is priority -- pass AllPris for all priorities -- see also DisconnectAllEvents
func (*Node2DBase) DisconnectViewport ¶ added in v0.9.8
func (nb *Node2DBase) DisconnectViewport()
DisconnectViewport disconnects the node's update signal to the viewport as a receiver
func (*Node2DBase) EventMgr2D ¶ added in v0.9.11
func (nb *Node2DBase) EventMgr2D() *EventMgr
EventMgr2D() returns the event manager for this node. Can be nil.
func (*Node2DBase) FindNamedElement ¶
func (nb *Node2DBase) FindNamedElement(name string) Node2D
func (*Node2DBase) FocusChanged2D ¶
func (nb *Node2DBase) FocusChanged2D(change FocusChanges)
func (*Node2DBase) FocusNext ¶
func (nb *Node2DBase) FocusNext()
FocusNext moves the focus onto the next item
func (*Node2DBase) FocusPrev ¶
func (nb *Node2DBase) FocusPrev()
FocusPrev moves the focus onto the previous item
func (*Node2DBase) FullInit2DTree ¶ added in v0.9.8
func (nb *Node2DBase) FullInit2DTree()
FullInit2DTree does a full reinitialization of the tree *below this node* this should be called whenever the tree is dynamically updated and new nodes are added below a given node -- e.g., loading a new SVG graph etc. prepares everything to be rendered as usual.
func (*Node2DBase) FullRender2DTree ¶
func (nb *Node2DBase) FullRender2DTree()
FullRender2DTree does a full render of the tree
func (*Node2DBase) GrabFocus ¶
func (nb *Node2DBase) GrabFocus()
GrabFocus grabs the keyboard input focus on this item or the first item within it that can be focused (if none, then goes ahead and sets focus to this object)
func (*Node2DBase) HasFocus2D ¶
func (nb *Node2DBase) HasFocus2D() bool
func (*Node2DBase) Init2D ¶
func (nb *Node2DBase) Init2D()
func (*Node2DBase) Init2DTree ¶
func (nb *Node2DBase) Init2DTree()
Init2DTree initializes scene graph tree from node it is called on -- only needs to be done once but must be robust to repeated calls -- use a flag if necessary -- needed after structural updates to ensure all nodes are updated
func (*Node2DBase) IsDirectWinUpload ¶ added in v0.9.8
func (nb *Node2DBase) IsDirectWinUpload() bool
func (*Node2DBase) IsVisible ¶
func (nb *Node2DBase) IsVisible() bool
func (*Node2DBase) Layout2D ¶
func (nb *Node2DBase) Layout2D(parBBox image.Rectangle, iter int) bool
func (*Node2DBase) Layout2DChildren ¶
func (nb *Node2DBase) Layout2DChildren(iter int) bool
Layout2DChildren does layout on all of node's children, giving them the ChildrenBBox2D -- default call at end of Layout2D. Passes along whether any of the children need a re-layout -- typically Layout2D just returns this.
func (*Node2DBase) Layout2DTree ¶
func (nb *Node2DBase) Layout2DTree()
Layout2DTree does layout pass -- each node iterates over children for maximum control -- this starts with parent VpBBox -- can be called de novo. Handles multiple iterations if needed.
func (*Node2DBase) MakeContextMenu ¶
func (nb *Node2DBase) MakeContextMenu(m *Menu)
func (*Node2DBase) Move2D ¶
func (nb *Node2DBase) Move2D(delta image.Point, parBBox image.Rectangle)
func (*Node2DBase) Move2DChildren ¶
func (nb *Node2DBase) Move2DChildren(delta image.Point)
Move2dChildren moves all of node's children, giving them the ChildrenBBox2D -- default call at end of Move2D
func (*Node2DBase) NeedsFullReRender2DTree ¶ added in v0.9.15
func (nb *Node2DBase) NeedsFullReRender2DTree() bool
NeedsFullReRender2DTree checks the entire tree below this node for any that have NeedsFullReRender flag set.
func (*Node2DBase) ParentLayout ¶
func (nb *Node2DBase) ParentLayout() *Layout
ParentLayout returns the parent layout
func (*Node2DBase) ParentPaint ¶
func (nb *Node2DBase) ParentPaint() *Paint
ParentPaint returns the Paint from parent, if available
func (*Node2DBase) ParentReRenderAnchor ¶
func (nb *Node2DBase) ParentReRenderAnchor() Node2D
ParentReRenderAnchor returns parent (including this node) that is a ReRenderAnchor -- for optimized re-rendering
func (*Node2DBase) ParentScrollLayout ¶
func (nb *Node2DBase) ParentScrollLayout() *Layout
ParentScrollLayout returns the parent layout that has active scrollbars
func (*Node2DBase) ParentStyle ¶
func (nb *Node2DBase) ParentStyle() *Style
ParentStyle returns parent's style or nil if not avail
func (*Node2DBase) ParentViewport ¶
func (nb *Node2DBase) ParentViewport() *Viewport2D
ParentViewport returns the parent viewport -- uses AsViewport2D() method on Node2D interface
func (*Node2DBase) ParentWindow ¶
func (nb *Node2DBase) ParentWindow() *Window
ParentWindow returns the parent window for this node
func (*Node2DBase) PropTag ¶
func (nb *Node2DBase) PropTag() string
func (*Node2DBase) Render2D ¶
func (nb *Node2DBase) Render2D()
func (*Node2DBase) Render2DChildren ¶
func (nb *Node2DBase) Render2DChildren()
Render2DChildren renders all of node's children -- default call at end of Render2D()
func (*Node2DBase) Render2DTree ¶
func (nb *Node2DBase) Render2DTree()
Render2DTree just calls on parent node and it takes full responsibility for managing the children -- this allows maximum flexibility for order etc of rendering
func (*Node2DBase) ScrollToMe ¶
func (nb *Node2DBase) ScrollToMe() bool
ScrollToMe tells my parent layout (that has scroll bars) to scroll to keep this widget in view -- returns true if scrolled
func (*Node2DBase) SetFixedHeight ¶ added in v0.9.10
func (nb *Node2DBase) SetFixedHeight(val units.Value)
SetFixedHeight sets all height options (height, min-height, max-height) to a fixed height value
func (*Node2DBase) SetFixedWidth ¶ added in v0.9.10
func (nb *Node2DBase) SetFixedWidth(val units.Value)
SetFixedWidth sets all width options (width, min-width, max-width) to a fixed width value
func (*Node2DBase) SetMinPrefHeight ¶ added in v0.9.10
func (nb *Node2DBase) SetMinPrefHeight(val units.Value)
SetMinPrefHeight sets minimum and preferred height -- will get at least this amount -- max unspecified
func (*Node2DBase) SetMinPrefWidth ¶ added in v0.9.10
func (nb *Node2DBase) SetMinPrefWidth(val units.Value)
SetMinPrefWidth sets minimum and preferred width -- will get at least this amount -- max unspecified
func (*Node2DBase) SetStretchMax ¶ added in v0.9.10
func (nb *Node2DBase) SetStretchMax()
SetStretchMax sets stretchy max width and height (-1) -- can grow to take up avail room
func (*Node2DBase) SetStretchMaxHeight ¶ added in v0.9.10
func (nb *Node2DBase) SetStretchMaxHeight()
SetStretchMaxHeight sets stretchy max height (-1) -- can grow to take up avail room
func (*Node2DBase) SetStretchMaxWidth ¶ added in v0.9.10
func (nb *Node2DBase) SetStretchMaxWidth()
SetStretchMaxWidth sets stretchy max width (-1) -- can grow to take up avail room
func (*Node2DBase) SetWinBBox ¶
func (nb *Node2DBase) SetWinBBox()
set our window-level BBox from vp and our bbox
func (*Node2DBase) Size2D ¶
func (nb *Node2DBase) Size2D(iter int)
func (*Node2DBase) Size2DTree ¶
func (nb *Node2DBase) Size2DTree(iter int)
Size2DTree does the sizing as a depth-first pass
func (*Node2DBase) StartFocus ¶
func (nb *Node2DBase) StartFocus()
StartFocus specifies this widget to give focus to when the window opens
func (*Node2DBase) Style2D ¶
func (nb *Node2DBase) Style2D()
func (*Node2DBase) Style2DTree ¶
func (nb *Node2DBase) Style2DTree()
Style2DTree styles scene graph tree from node it is called on -- only needs to be done after a structural update in case inherited options changed
func (*Node2DBase) TopNode2D ¶ added in v0.9.11
func (nb *Node2DBase) TopNode2D() Node
TopNode2D() returns the top-level node of the 2D tree, which can be either a Window or a Viewport typically. This is used for UpdateStart / End around multiple dispersed updates to properly batch everything and prevent redundant updates.
func (*Node2DBase) TopUpdateEnd ¶ added in v0.9.11
func (nb *Node2DBase) TopUpdateEnd(updt bool)
TopUpdateEnd calls UpdateEnd on TopNode2D(). Use this for TopUpdateStart / End around multiple dispersed updates to properly batch everything and prevent redundant updates.
func (*Node2DBase) TopUpdateStart ¶ added in v0.9.11
func (nb *Node2DBase) TopUpdateStart() bool
TopUpdateStart calls UpdateStart on TopNode2D(). Use this for TopUpdateStart / End around multiple dispersed updates to properly batch everything and prevent redundant updates.
func (*Node2DBase) WinFullReRender ¶ added in v0.9.8
func (nb *Node2DBase) WinFullReRender()
WinFullReRender tells the window to do a full re-render of everything on next publish -- call this on containers that might contain DirectUpload widgets.
type NodeBase ¶
type NodeBase struct { ki.Node Class string `` /* 202-byte string literal not displayed */ CSS ki.Props `` /* 228-byte string literal not displayed */ CSSAgg ki.Props `copy:"-" json:"-" xml:"-" view:"no-inline" desc:"aggregated css properties from all higher nodes down to me"` BBox image.Rectangle `` /* 201-byte string literal not displayed */ ObjBBox image.Rectangle `` /* 208-byte string literal not displayed */ VpBBox image.Rectangle `` /* 240-byte string literal not displayed */ WinBBox image.Rectangle `` /* 207-byte string literal not displayed */ }
NodeBase is the base struct type for GoGi graphical interface system, containing infrastructure for both 2D and 3D scene graph nodes
func (*NodeBase) AddClass ¶ added in v0.9.5
AddClass adds a CSS class name -- does proper space separation
func (*NodeBase) ClearFullReRender ¶
func (nb *NodeBase) ClearFullReRender()
ClearFullReRender clears node as needing a full ReRender
func (*NodeBase) ClearInactive ¶
func (nb *NodeBase) ClearInactive()
ClearInactive clears the node as inactive
func (*NodeBase) ClearInvisible ¶
func (nb *NodeBase) ClearInvisible()
ClearInvisible clears the node as invisible
func (*NodeBase) ClearSelected ¶
func (nb *NodeBase) ClearSelected()
ClearSelected sets the node as not selected
func (*NodeBase) CopyFieldsFrom ¶ added in v0.9.8
func (nb *NodeBase) CopyFieldsFrom(frm interface{})
func (*NodeBase) FirstContainingPoint ¶
FirstContainingPoint finds the first node whose WinBBox contains the given point -- nil if none. If leavesOnly is set then only nodes that have no nodes (leaves, terminal nodes) will be considered
func (*NodeBase) HasNoLayout ¶
HasNoLayout checks if the current node is flagged as not needing layout
func (*NodeBase) IsDragging ¶
IsDragging tests if the current node is currently flagged as receiving dragging events -- flag set by window
func (*NodeBase) IsInactive ¶
IsInactive tests if this node is flagged as Inactive. if so, behave (e.g., ignore events except select, context menu) and style appropriately
func (*NodeBase) IsInstaDrag ¶
IsInstaDrag tests if the current node has InstaDrag property set
func (*NodeBase) IsInvisible ¶
IsInvisible tests if this node is flagged as Invisible. if so, do not render, update, interact.
func (*NodeBase) IsReRenderAnchor ¶
IsReRenderAnchor returns whethers the current node is a ReRenderAnchor
func (*NodeBase) IsSelected ¶
IsSelected tests if this node is flagged as Selected
func (*NodeBase) NeedsFullReRender ¶
NeedsFullReRender checks if node has said it needs full re-render
func (*NodeBase) ParentCSSAgg ¶
ParentCSSAgg returns parent's CSSAgg styles or nil if not avail
func (*NodeBase) PointToRelPos ¶
translate a point in global pixel coords into relative position within node
func (*NodeBase) SetActiveState ¶
SetActiveState sets flag as active or not based on act arg -- positive logic is easier to understand.
func (*NodeBase) SetActiveStateUpdt ¶
SetActiveStateUpdt sets flag as active or not based on act arg -- positive logic is easier to understand -- does UpdateSig if state changed.
func (*NodeBase) SetCanFocus ¶ added in v0.9.8
func (nb *NodeBase) SetCanFocus()
SetCanFocus sets CanFocus flag to true
func (*NodeBase) SetCanFocusIfActive ¶
func (nb *NodeBase) SetCanFocusIfActive()
SetCanFocusIfActive sets CanFocus flag only if node is active (inactive nodes don't need focus typically)
func (*NodeBase) SetFocusState ¶ added in v0.9.11
SetFocusState sets current HasFocus state
func (*NodeBase) SetFullReRender ¶
func (nb *NodeBase) SetFullReRender()
SetFullReRender sets node as needing a full ReRender
func (*NodeBase) SetInactive ¶
func (nb *NodeBase) SetInactive()
SetInactive sets the node as inactive
func (*NodeBase) SetInactiveState ¶
SetInactiveState sets flag as inactive or not based on inact arg
func (*NodeBase) SetInactiveStateUpdt ¶
SetInactiveStateUpdt sets flag as inactive or not based on inact arg, and does UpdateSig if state changed.
func (*NodeBase) SetInvisible ¶
func (nb *NodeBase) SetInvisible()
SetInvisible sets the node as invisible
func (*NodeBase) SetInvisibleState ¶
SetInvisibleState sets flag as invisible or not based on invis arg
func (*NodeBase) SetReRenderAnchor ¶
func (nb *NodeBase) SetReRenderAnchor()
SetReRenderAnchor sets node as a ReRenderAnchor
func (*NodeBase) SetSelected ¶
func (nb *NodeBase) SetSelected()
SetSelected sets the node as selected
func (*NodeBase) SetSelectedState ¶
SetSelectedState set flag as selected or not based on sel arg
func (*NodeBase) SetStdXMLAttr ¶
SetStdXMLAttr sets standard attributes of node given XML-style name / attribute values (e.g., from parsing XML / SVG files) -- returns true if handled
func (*NodeBase) StyleProps ¶
StyleProps returns a property that contains another map of properties for a given styling selector, such as :normal :active :hover etc -- the convention is to prefix this selector with a : and use lower-case names, so we follow that.
type NodeFlags ¶
type NodeFlags int
NodeFlags define gi node bitflags for tracking common high-frequency GUI state, mostly having to do with event processing -- use properties map for less frequently used information -- uses ki Flags field (64 bit capacity)
const ( // NoLayout means that this node does not participate in the layout // process (Size, Layout, Move) -- set by e.g., SVG nodes NoLayout NodeFlags = NodeFlags(ki.FlagsN) + iota // EventsConnected: this node has been connected to receive events from // the window -- to optimize event processing, connections are typically // only established for visible nodes during render, and disconnected when // not visible EventsConnected // CanFocus: can this node accept focus to receive keyboard input events // -- set by default for typical nodes that do so, but can be overridden, // including by the style 'can-focus' property CanFocus // HasFocus: does this node currently have the focus for keyboard input // events? use tab / alt tab and clicking events to update focus -- see // interface on Window HasFocus // FullReRender indicates that a full re-render is required due to nature // of update event -- otherwise default is local re-render -- used // internally for nodes to determine what to do on the ReRender step FullReRender // ReRenderAnchor: this node has a static size, and repaints its // background -- any children under it that need to dynamically resize on // a ReRender (Update) can refer the update up to rerendering this node, // instead of going further up the tree -- e.g., true of Frame's within a // SplitView ReRenderAnchor // Invisible means that the node has been marked as invisible by a parent // that has switch-like powers (e.g., layout stacked / tabview or splitter // panel that has been collapsed). This flag is propagated down to all // child nodes, and rendering or other interaction / update routines // should not run when this flag is set (PushBounds does this for most // cases). However, it IS a good idea to have styling, layout etc all // take place as normal, so that when the flag is cleared, rendering can // proceed directly. Invisible // Inactive disables interaction with widgets or other nodes (i.e., they // are read-only) -- they should indicate this inactive state in an // appropriate way, and each node should interpret events appropriately // based on this state (select and context menu events should still be // generated) Inactive // Selected indicates that this node has been selected by the user -- // widely supported across different nodes Selected // MouseHasEntered indicates that the MouseFocusEvent Enter was previously // registered on this node MouseHasEntered // DNDHasEntered indicates that the DNDFocusEvent Enter was previously // registered on this node DNDHasEntered // NodeDragging indicates this node is currently dragging -- win.Dragging // set to this node NodeDragging // InstaDrag indicates this node should start dragging immediately when // clicked -- otherwise there is a time-and-distance threshold to the // start of dragging -- use this for controls that are small and are // primarily about dragging (e.g., the Splitter handle) InstaDrag // can extend node flags from here NodeFlagsN )
const ( // TextFieldFocusActive indicates that the focus is active in this field TextFieldFocusActive NodeFlags = NodeFlagsN + iota )
these extend NodeBase NodeFlags to hold TextField state
func StringToNodeFlags ¶
type Overflow ¶
type Overflow int32
overflow type -- determines what happens when there is too much stuff in a layout
const ( // OverflowAuto automatically determines if scrollbars should be added to show // the overflow. Scrollbars are added only if the actual content size is greater // than the currently available size. Typically, an outer-most Layout will scale // up and add scrollbars to accommodate the Min needs of its child elements, // so if you want to have scrollbars show up on inner elements, they need to // have a style setting that restricts their Min size, but also allows them to // stretch so they use whatever space they are allocated. OverflowAuto Overflow = iota // OverflowScroll means add scrollbars when necessary, and is essentially // identical to Auto. However, only during Viewport PrefSize call, // the actual content size is used -- otherwise it behaves just like Auto. OverflowScroll // OverflowVisible makes the overflow visible -- this is generally unsafe // and not very feasible and will be ignored as long as possible. // Currently it falls back on Auto, but could go to Hidden if that works // better overall. OverflowVisible // OverflowHidden hides the overflow and doesn't present scrollbars (supported). OverflowHidden OverflowN )
func (*Overflow) FromString ¶
func (Overflow) MarshalJSON ¶
func (*Overflow) UnmarshalJSON ¶
type Paint ¶
type Paint struct { Off bool `desc:"node and everything below it are off, non-rendering"` StyleSet bool `desc:"have the styles already been set?"` PropsNil bool `desc:"set to true if parent node has no props -- allows optimization of styling"` UnContext units.Context `xml:"-" desc:"units context -- parameters necessary for anchoring relative units"` StrokeStyle StrokeStyle `desc:"stroke (line drawing) parameters"` FillStyle FillStyle `desc:"fill (region filling) parameters"` FontStyle FontStyle `` /* 146-byte string literal not displayed */ TextStyle TextStyle `` /* 146-byte string literal not displayed */ VecEff VectorEffects `xml:"vector-effect" desc:"prop: vector-effect = various rendering special effects settings"` XForm mat32.Mat2 `xml:"transform" desc:"prop: transform = our additions to transform -- pushed to render state"` // contains filtered or unexported fields }
Paint provides the styling parameters and methods for rendering on to an RGBA image -- all dynamic rendering state is maintained in the RenderState. Text rendering is handled separately in TextRender, but it depends minimally on styling parameters in FontStyle
func (*Paint) AsMask ¶
func (pc *Paint) AsMask(rs *RenderState) *image.Alpha
AsMask returns an *image.Alpha representing the alpha channel of this context. This can be useful for advanced clipping operations where you first render the mask geometry and then use it as a mask.
func (*Paint) BoundingBox ¶
func (pc *Paint) BoundingBox(rs *RenderState, minX, minY, maxX, maxY float32) image.Rectangle
BoundingBox computes the bounding box for an element in pixel int coordinates, applying current transform
func (*Paint) BoundingBoxFromPoints ¶
BoundingBoxFromPoints computes the bounding box for a slice of points
func (*Paint) Clear ¶
func (pc *Paint) Clear(rs *RenderState)
Clear fills the entire image with the current fill color.
func (*Paint) ClearPath ¶
func (pc *Paint) ClearPath(rs *RenderState)
ClearPath clears the current path. There is no current point after this operation.
func (*Paint) Clip ¶
func (pc *Paint) Clip(rs *RenderState)
Clip updates the clipping region by intersecting the current clipping region with the current path as it would be filled by pc.Fill(). The path is cleared after this operation.
func (*Paint) ClipPreserve ¶
func (pc *Paint) ClipPreserve(rs *RenderState)
ClipPreserve updates the clipping region by intersecting the current clipping region with the current path as it would be filled by pc.Fill(). The path is preserved after this operation.
func (*Paint) ClosePath ¶
func (pc *Paint) ClosePath(rs *RenderState)
ClosePath adds a line segment from the current point to the beginning of the current subpath. If there is no current point, this is a no-op.
func (*Paint) CopyStyleFrom ¶
CopyStyleFrom copies styles from another paint
func (*Paint) CubicTo ¶
func (pc *Paint) CubicTo(rs *RenderState, x1, y1, x2, y2, x3, y3 float32)
CubicTo adds a cubic bezier curve to the current path starting at the current point. If there is no current point, it first performs MoveTo(x1, y1).
func (*Paint) DrawArc ¶
func (pc *Paint) DrawArc(rs *RenderState, x, y, r, angle1, angle2 float32)
func (*Paint) DrawCircle ¶
func (pc *Paint) DrawCircle(rs *RenderState, x, y, r float32)
func (*Paint) DrawEllipse ¶
func (pc *Paint) DrawEllipse(rs *RenderState, x, y, rx, ry float32)
func (*Paint) DrawEllipticalArc ¶
func (pc *Paint) DrawEllipticalArc(rs *RenderState, cx, cy, rx, ry, angle1, angle2 float32)
DrawEllipticalArc draws arc between angle1 and angle2 along an ellipse, using quadratic bezier curves -- centers of ellipse are at cx, cy with radii rx, ry -- see DrawEllipticalArcPath for a version compatible with SVG A/a path drawing, which uses previous position instead of two angles
func (*Paint) DrawEllipticalArcPath ¶
func (pc *Paint) DrawEllipticalArcPath(rs *RenderState, cx, cy, ocx, ocy, pcx, pcy, rx, ry, angle float32, largeArc, sweep bool) (lx, ly float32)
DrawEllipticalArcPath is draws an arc centered at cx,cy with radii rx, ry, through given angle, either via the smaller or larger arc, depending on largeArc -- returns in lx, ly the last points which are then set to the current cx, cy for the path drawer
func (*Paint) DrawImage ¶
func (pc *Paint) DrawImage(rs *RenderState, fmIm image.Image, x, y int)
DrawImage draws the specified image at the specified point.
func (*Paint) DrawImageAnchored ¶
DrawImageAnchored draws the specified image at the specified anchor point. The anchor point is x - w * ax, y - h * ay, where w, h is the size of the image. Use ax=0.5, ay=0.5 to center the image at the specified point.
func (*Paint) DrawLine ¶
func (pc *Paint) DrawLine(rs *RenderState, x1, y1, x2, y2 float32)
func (*Paint) DrawPolygon ¶
func (pc *Paint) DrawPolygon(rs *RenderState, points []mat32.Vec2)
func (*Paint) DrawPolygonPxToDots ¶
func (pc *Paint) DrawPolygonPxToDots(rs *RenderState, points []mat32.Vec2)
func (*Paint) DrawPolyline ¶
func (pc *Paint) DrawPolyline(rs *RenderState, points []mat32.Vec2)
func (*Paint) DrawPolylinePxToDots ¶
func (pc *Paint) DrawPolylinePxToDots(rs *RenderState, points []mat32.Vec2)
func (*Paint) DrawRectangle ¶
func (pc *Paint) DrawRectangle(rs *RenderState, x, y, w, h float32)
func (*Paint) DrawRegularPolygon ¶
func (pc *Paint) DrawRegularPolygon(rs *RenderState, n int, x, y, r, rotation float32)
func (*Paint) DrawRoundedRectangle ¶
func (pc *Paint) DrawRoundedRectangle(rs *RenderState, x, y, w, h, r float32)
func (*Paint) Fill ¶
func (pc *Paint) Fill(rs *RenderState)
Fill fills the current path with the current color. Open subpaths are implicitly closed. The path is cleared after this operation.
func (*Paint) FillBox ¶
func (pc *Paint) FillBox(rs *RenderState, pos, size mat32.Vec2, clr *ColorSpec)
FillBox is an optimized fill of a square region with a uniform color if the given color spec is a solid color
func (*Paint) FillBoxColor ¶
FillBoxColor is an optimized fill of a square region with given uniform color
func (*Paint) FillPreserve ¶
func (pc *Paint) FillPreserve(rs *RenderState)
FillPreserve fills the current path with the current color. Open subpaths are implicitly closed. The path is preserved after this operation.
func (*Paint) FillStrokeClear ¶
func (pc *Paint) FillStrokeClear(rs *RenderState)
convenience for final draw for shapes when done
func (*Paint) HasNoStrokeOrFill ¶
does the current Paint not have either a stroke or fill? in which case, often we just skip it
func (*Paint) Identity ¶
func (pc *Paint) Identity()
Identity resets the current transformation matrix to the identity matrix. This results in no translating, scaling, rotating, or shearing.
func (*Paint) InheritFields ¶
InheritFields from parent: Manual inheriting of values is much faster than automatic version!
func (*Paint) InvertY ¶
func (pc *Paint) InvertY(rs *RenderState)
InvertY flips the Y axis so that Y grows from bottom to top and Y=0 is at the bottom of the image.
func (*Paint) LineTo ¶
func (pc *Paint) LineTo(rs *RenderState, x, y float32)
LineTo adds a line segment to the current path starting at the current point. If there is no current point, it is equivalent to MoveTo(x, y)
func (*Paint) MoveTo ¶
func (pc *Paint) MoveTo(rs *RenderState, x, y float32)
MoveTo starts a new subpath within the current path starting at the specified point.
func (*Paint) NewSubPath ¶
func (pc *Paint) NewSubPath(rs *RenderState)
NewSubPath starts a new subpath within the current path. There is no current point after this operation.
func (*Paint) QuadraticTo ¶
func (pc *Paint) QuadraticTo(rs *RenderState, x1, y1, x2, y2 float32)
QuadraticTo adds a quadratic bezier curve to the current path starting at the current point. If there is no current point, it first performs MoveTo(x1, y1)
func (*Paint) ResetClip ¶
func (pc *Paint) ResetClip(rs *RenderState)
ResetClip clears the clipping region.
func (*Paint) Rotate ¶
Rotate updates the current matrix with a clockwise rotation. Rotation occurs about the origin. Angle is specified in radians.
func (*Paint) RotateAbout ¶
RotateAbout updates the current matrix with a clockwise rotation. Rotation occurs about the specified point. Angle is specified in radians.
func (*Paint) Scale ¶
Scale updates the current matrix with a scaling factor. Scaling occurs about the origin.
func (*Paint) ScaleAbout ¶
ScaleAbout updates the current matrix with a scaling factor. Scaling occurs about the specified point.
func (*Paint) SetMask ¶
func (pc *Paint) SetMask(rs *RenderState, mask *image.Alpha) error
SetMask allows you to directly set the *image.Alpha to be used as a clipping mask. It must be the same size as the context, else an error is returned and the mask is unchanged.
func (*Paint) SetPixel ¶
func (pc *Paint) SetPixel(rs *RenderState, x, y int)
SetPixel sets the color of the specified pixel using the current stroke color.
func (*Paint) SetStyleProps ¶
func (pc *Paint) SetStyleProps(par *Paint, props ki.Props, vp *Viewport2D)
SetStyleProps sets paint values based on given property map (name: value pairs), inheriting elements as appropriate from parent, and also having a default style for the "initial" setting
func (*Paint) SetUnitContext ¶
func (pc *Paint) SetUnitContext(vp *Viewport2D, el mat32.Vec2)
SetUnitContext sets the unit context based on size of viewport and parent element (from bbox) and then cache everything out in terms of raw pixel dots for rendering -- call at start of render
func (*Paint) SetUnitContextExt ¶ added in v0.9.9
SetUnitContextExt sets the unit context for external usage of paint outside of a Viewport, based on overall size of painting canvas. caches everything out in terms of raw pixel dots for rendering call at start of render.
func (*Paint) Shear ¶
Shear updates the current matrix with a shearing angle. Shearing occurs about the origin.
func (*Paint) ShearAbout ¶
ShearAbout updates the current matrix with a shearing angle. Shearing occurs about the specified point.
func (*Paint) Stroke ¶
func (pc *Paint) Stroke(rs *RenderState)
Stroke strokes the current path with the current color, line width, line cap, line join and dash settings. The path is cleared after this operation.
func (*Paint) StrokePreserve ¶
func (pc *Paint) StrokePreserve(rs *RenderState)
StrokePreserve strokes the current path with the current color, line width, line cap, line join and dash settings. The path is preserved after this operation.
func (*Paint) StrokeWidth ¶
func (pc *Paint) StrokeWidth(rs *RenderState) float32
StrokeWidth obtains the current stoke width subject to transform (or not depending on VecEffNonScalingStroke)
func (*Paint) StyleFromProps ¶ added in v0.9.8
func (pc *Paint) StyleFromProps(par *Paint, props ki.Props, vp *Viewport2D)
StyleFromProps sets style field values based on ki.Props properties
func (*Paint) StyleToDots ¶ added in v0.9.8
StyleToDots runs ToDots on unit values, to compile down to raw pixels
func (*Paint) TransformPoint ¶
func (pc *Paint) TransformPoint(rs *RenderState, x, y float32) mat32.Vec2
TransformPoint multiplies the specified point by the current transform matrix, returning a transformed position.
type Painter ¶
type Painter interface {
Paint() *Paint
}
Painter defines an interface for anything that has a Paint on it
type ParamPrefs ¶
type ParamPrefs struct { DoubleClickMSec int `min:"100" step:"50" desc:"the maximum time interval in msec between button press events to count as a double-click"` ScrollWheelSpeed float32 `` /* 290-byte string literal not displayed */ LocalMainMenu bool `` /* 326-byte string literal not displayed */ BigFileSize int `def:"10000000" desc:"the limit of file size, above which user will be prompted before opening / copying, etc."` SavedPathsMax int `desc:"maximum number of saved paths to save in FileView"` Smooth3D bool `` /* 175-byte string literal not displayed */ }
ParamPrefs contains misc parameters controlling GUI behavior.
func (*ParamPrefs) Defaults ¶
func (pf *ParamPrefs) Defaults()
type PartsWidgetBase ¶
type PartsWidgetBase struct { WidgetBase Parts Layout `` /* 214-byte string literal not displayed */ }
PartsWidgetBase is the base type for all Widget Node2D elements that manage a set of constituent parts
func (*PartsWidgetBase) ComputeBBox2D ¶
func (wb *PartsWidgetBase) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)
func (*PartsWidgetBase) ComputeBBox2DParts ¶
func (wb *PartsWidgetBase) ComputeBBox2DParts(parBBox image.Rectangle, delta image.Point)
func (*PartsWidgetBase) ConfigPartsIconLabel ¶
func (wb *PartsWidgetBase) ConfigPartsIconLabel(config *kit.TypeAndNameList, icnm string, txt string) (icIdx, lbIdx int)
ConfigPartsIconLabel adds to config to create parts, of icon and label left-to right in a row, based on whether items are nil or empty
func (*PartsWidgetBase) ConfigPartsSetIconLabel ¶
func (wb *PartsWidgetBase) ConfigPartsSetIconLabel(icnm string, txt string, icIdx, lbIdx int)
ConfigPartsSetIconLabel sets the icon and text values in parts, and get part style props, using given props if not set in object props
func (*PartsWidgetBase) CopyFieldsFrom ¶ added in v0.9.8
func (wb *PartsWidgetBase) CopyFieldsFrom(frm interface{})
func (*PartsWidgetBase) Layout2D ¶
func (wb *PartsWidgetBase) Layout2D(parBBox image.Rectangle, iter int) bool
func (*PartsWidgetBase) Layout2DParts ¶
func (wb *PartsWidgetBase) Layout2DParts(parBBox image.Rectangle, iter int)
func (*PartsWidgetBase) Move2D ¶
func (wb *PartsWidgetBase) Move2D(delta image.Point, parBBox image.Rectangle)
func (*PartsWidgetBase) PartsNeedUpdateIconLabel ¶
func (wb *PartsWidgetBase) PartsNeedUpdateIconLabel(icnm string, txt string) bool
PartsNeedUpdateIconLabel check if parts need to be updated -- for ConfigPartsIfNeeded
func (*PartsWidgetBase) Render2DParts ¶
func (wb *PartsWidgetBase) Render2DParts()
func (*PartsWidgetBase) SetFullReRenderIconLabel ¶
func (wb *PartsWidgetBase) SetFullReRenderIconLabel()
SetFullReRenderIconLabel sets the icon and label to be re-rendered, needed when styles change
func (*PartsWidgetBase) Size2D ¶
func (wb *PartsWidgetBase) Size2D(iter int)
func (*PartsWidgetBase) Size2DParts ¶
func (wb *PartsWidgetBase) Size2DParts(iter int)
func (*PartsWidgetBase) SizeFromParts ¶
func (wb *PartsWidgetBase) SizeFromParts(iter int)
SizeFromParts sets our size from those of our parts -- default..
type Preferences ¶
type Preferences struct { LogicalDPIScale float32 `` /* 148-byte string literal not displayed */ ScreenPrefs map[string]ScreenPrefs `desc:"screen-specific preferences -- will override overall defaults if set"` Colors ColorPrefs `desc:"active color preferences"` ColorSchemes map[string]*ColorPrefs `desc:"named color schemes -- has Light and Dark schemes by default"` Params ParamPrefs `view:"inline" desc:"parameters controlling GUI behavior"` Editor EditorPrefs `view:"inline" desc:"editor preferences -- for TextView etc"` KeyMap KeyMapName `desc:"select the active keymap from list of available keymaps -- see Edit KeyMaps for editing / saving / loading that list"` SaveKeyMaps bool `` /* 403-byte string literal not displayed */ SaveDetailed bool `desc:"if set, the detailed preferences are saved and loaded at startup -- only "` CustomStyles ki.Props `` /* 189-byte string literal not displayed */ CustomStylesOverride bool `` /* 208-byte string literal not displayed */ FontFamily FontName `desc:"default font family when otherwise not specified"` MonoFont FontName `desc:"default mono-spaced font family"` FontPaths []string `desc:"extra font paths, beyond system defaults -- searched first"` User User `desc:"user info -- partially filled-out automatically if empty / when prefs first created"` FavPaths FavPaths `desc:"favorite paths, shown in FileViewer and also editable there"` FileViewSort string `view:"-" desc:"column to sort by in FileView, and :up or :down for direction -- updated automatically via FileView"` ColorFilename FileName `view:"-" ext:".json" desc:"filename for saving / loading colors"` Changed bool `` /* 164-byte string literal not displayed */ }
Preferences are the overall user preferences for GoGi, providing some basic customization -- in addition, most gui settings can be styled using CSS-style sheets under CustomStyle. These prefs are saved and loaded from the GoGi user preferences directory -- see oswin/App for further info.
func (*Preferences) Apply ¶
func (pf *Preferences) Apply()
Apply preferences to all the relevant settings.
func (*Preferences) ApplyDPI ¶
func (pf *Preferences) ApplyDPI()
ApplyDPI updates the screen LogicalDPI values according to current preferences and zoom factor, and then updates all open windows as well.
func (*Preferences) DarkMode ¶ added in v0.9.11
func (pf *Preferences) DarkMode()
DarkMode sets colors to dark mode
func (*Preferences) Defaults ¶
func (pf *Preferences) Defaults()
func (*Preferences) DeleteSavedWindowGeoms ¶
func (pf *Preferences) DeleteSavedWindowGeoms()
DeleteSavedWindowGeoms deletes the file that saves the position and size of each window, by screen, and clear current in-memory cache. You shouldn't need to use this but sometimes useful for testing.
func (*Preferences) EditDebug ¶
func (pf *Preferences) EditDebug()
EditDebug opens the PrefsDbgView editor to edit debugging params
func (*Preferences) EditDetailed ¶
func (pf *Preferences) EditDetailed()
EditDetailed opens the PrefsDetView editor to edit detailed params
func (*Preferences) EditHiStyles ¶ added in v0.9.11
func (pf *Preferences) EditHiStyles()
EditHiStyles opens the HiStyleView editor to customize highlighting styles
func (*Preferences) EditKeyMaps ¶
func (pf *Preferences) EditKeyMaps()
EditKeyMaps opens the KeyMapsView editor to create new keymaps / save / load from other files, etc. Current avail keymaps are saved and loaded with preferences automatically.
func (*Preferences) IsDarkMode ¶ added in v0.9.11
func (pf *Preferences) IsDarkMode() bool
IsDarkMode returns true if the current background color preference is dark
func (*Preferences) LightMode ¶ added in v0.9.11
func (pf *Preferences) LightMode()
LightMode sets colors to light mode
func (*Preferences) Open ¶
func (pf *Preferences) Open() error
Open preferences from GoGi standard prefs directory
func (*Preferences) OpenColors ¶
func (pf *Preferences) OpenColors(filename FileName) error
OpenColors colors from a JSON-formatted file.
func (*Preferences) Save ¶
func (pf *Preferences) Save() error
Save Preferences to GoGi standard prefs directory
func (*Preferences) SaveColors ¶
func (pf *Preferences) SaveColors(filename FileName) error
Save colors to a JSON-formatted file, for easy sharing of your favorite palettes.
func (*Preferences) SaveZoom ¶
func (pf *Preferences) SaveZoom(forCurrentScreen bool)
SaveZoom saves the current LogicalDPI scaling, either as the overall default or specific to the current screen.
func (*Preferences) ScreenInfo ¶
func (pf *Preferences) ScreenInfo() string
ScreenInfo returns screen info for all screens on the console.
func (*Preferences) UpdateAll ¶ added in v0.9.11
func (pf *Preferences) UpdateAll()
UpdateAll updates all open windows with current preferences -- triggers rebuild of default styles.
func (*Preferences) UpdateUser ¶
func (pf *Preferences) UpdateUser()
UpdateUser gets the user info from the OS
func (*Preferences) VersionInfo ¶ added in v0.9.1
func (pf *Preferences) VersionInfo() string
VersionInfo returns GoGi version information
type PrefsDebug ¶
type PrefsDebug struct { Update2DTrace *bool `desc:"reports trace of updates that trigger re-rendering (printfs to stdout)"` Render2DTrace *bool `desc:"reports trace of the nodes rendering (printfs to stdout)"` Layout2DTrace *bool `desc:"reports trace of all layouts (printfs to stdout)"` WinEventTrace *bool `desc:"reports trace of window events (printfs to stdout)"` WinPublishTrace *bool `` /* 140-byte string literal not displayed */ KeyEventTrace *bool `desc:"reports trace of keyboard events (printfs to stdout)"` EventTrace *bool `desc:"reports trace of event handling (printfs to stdout)"` DNDTrace *bool `desc:"reports trace of DND events handling"` GoCompleteTrace *bool `desc:"reports trace of Go language completion & lookup process"` GoTypeTrace *bool `desc:"reports trace of Go language type parsing and inference process"` Changed bool `` /* 164-byte string literal not displayed */ }
PrefsDebug are debugging params
func (*PrefsDebug) Connect ¶
func (pf *PrefsDebug) Connect()
Connect connects debug fields with actual variables controlling debugging
type PrefsDetailed ¶
type PrefsDetailed struct { MenuMaxHeight int `` /* 145-byte string literal not displayed */ EventSkipLagMSec int `` /* 216-byte string literal not displayed */ FilterLaggyKeyEvents bool `def:"false" desc:"set to true to apply laggy filter to KeyEvents (normally excluded)"` DragStartMSec int `` /* 159-byte string literal not displayed */ DragStartPix int `` /* 162-byte string literal not displayed */ DNDStartMSec int `` /* 151-byte string literal not displayed */ DNDStartPix int `` /* 154-byte string literal not displayed */ HoverStartMSec int `` /* 145-byte string literal not displayed */ HoverMaxPix int `def:"5" min:"0" max:"1000" step:"1" desc:"the maximum number of pixels that mouse can move and still register a Hover event"` CompleteWaitMSec int `def:"500" min:"10" max:"10000" step:"10" desc:"the number of milliseconds to wait before offering completions"` CompleteMaxItems int `def:"25" min:"5" step:"1" desc:"the maximum number of completions offered in popup"` CursorBlinkMSec int `` /* 129-byte string literal not displayed */ LayoutAutoScrollDelayMSec int `def:"25" min:"1" step:"5" desc:"is amount of time to wait (in Milliseconds) before trying to autoscroll again"` LayoutPageSteps int `def:"10" min:"1" step:"1" desc:"number of steps to take in PageUp / Down events in terms of number of items"` LayoutFocusNameTimeoutMSec int `` /* 183-byte string literal not displayed */ LayoutFocusNameTabMSec int `` /* 158-byte string literal not displayed */ DialogsSepWindow bool `def:"true" desc:"open dialogs in separate windows -- else do as popups in main window"` TextViewClipHistMax int `def:"100" min:"0" max:"1000" step:"5" desc:"Maximum amount of clipboard history to retain"` TextBufMaxScopeLines int `def:"100" min:"10" step:"10" desc:"maximum number of lines to look for matching scope syntax (parens, brackets)"` TextBufDiffRevertLines int `` /* 146-byte string literal not displayed */ TextBufDiffRevertDiffs int `` /* 180-byte string literal not displayed */ TextBufMarkupDelayMSec int `` /* 204-byte string literal not displayed */ MapInlineLen int `` /* 172-byte string literal not displayed */ StructInlineLen int `` /* 181-byte string literal not displayed */ SliceInlineLen int `def:"6" min:"2" step:"1" desc:"the number of slice elements below which inline will be used"` Changed bool `` /* 164-byte string literal not displayed */ }
PrefsDetailed are more detailed params not usually customized, but available for those who really care..
func (*PrefsDetailed) Apply ¶
func (pf *PrefsDetailed) Apply()
Apply detailed preferences to all the relevant settings.
func (*PrefsDetailed) Defaults ¶
func (pf *PrefsDetailed) Defaults()
Defaults gets current values of parameters, which are effectively defaults
func (*PrefsDetailed) Open ¶
func (pf *PrefsDetailed) Open() error
Open detailed preferences from GoGi standard prefs directory
func (*PrefsDetailed) Save ¶
func (pf *PrefsDetailed) Save() error
Save detailed prefs to GoGi standard prefs directory
type RGBAf32 ¶
type RGBAf32 struct {
R, G, B, A float32
}
RGBAf32 stores alpha-premultiplied RGBA values in float32 0..1 normalized format -- more useful for converting to other spaces
type RegionMap2D ¶
type RegionMap2D struct { Target Region2D `desc:"target region to render into (e.g., in RenderPlane)"` Rescale mgl32.Vec2 `` /* 165-byte string literal not displayed */ Size mgl32.Vec2 `desc:"Our overall size: Target.Size * Rescale"` }
defines how a region in 2D space is mapped
type RenderState ¶
type RenderState struct { Paint Paint `desc:"communal painter -- for widgets -- SVG have their own"` XForm mat32.Mat2 `desc:"current transform"` Path rasterx.Path `desc:"current path"` Raster *rasterx.Dasher `desc:"rasterizer -- stroke / fill rendering engine from rasterx"` // Scanner *scanFT.ScannerFT `desc:"scanner for freetype-based rasterx"` // CompSpanner *scanx.CompressSpanner `desc:"spanner for scanx"` Scanner *scanx.Scanner `desc:"scanner for scanx"` ImgSpanner *scanx.ImgSpanner `desc:"spanner for scanx"` Start mat32.Vec2 `desc:"starting point, for close path"` Current mat32.Vec2 `desc:"current point"` HasCurrent bool `desc:"is current point current?"` Image *image.RGBA `desc:"pointer to image to render into"` Mask *image.Alpha `desc:"current mask"` Bounds image.Rectangle `` /* 136-byte string literal not displayed */ LastRenderBBox image.Rectangle `desc:"bounding box of last object rendered -- computed by renderer during Fill or Stroke, grabbed by SVG objects"` XFormStack []mat32.Mat2 `desc:"stack of transforms"` BoundsStack []image.Rectangle `desc:"stack of bounds -- every render starts with a push onto this stack, and finishes with a pop"` ClipStack []*image.Alpha `desc:"stack of clips, if needed"` PaintBack Paint `desc:"backup of paint -- don't need a full stack but sometimes safer to backup and restore"` RenderMu sync.Mutex `desc:"mutex for overall rendering"` RasterMu sync.Mutex `desc:"mutex for final rasterx rendering -- only one at a time"` }
The RenderState holds all the current rendering state information used while painting -- a viewport just has one of these
func (*RenderState) BackupPaint ¶
func (rs *RenderState) BackupPaint()
BackupPaint copies style settings from Paint to PaintBack
func (*RenderState) Init ¶
func (rs *RenderState) Init(width, height int, img *image.RGBA)
Init initializes RenderState -- must be called whenever image size changes
func (*RenderState) Lock ¶
func (rs *RenderState) Lock()
Lock locks the render mutex -- must lock prior to rendering!
func (*RenderState) PopBounds ¶
func (rs *RenderState) PopBounds()
PopBounds pops bounds off the stack and set to current bounds must be equally balanced with corresponding PushBounds
func (*RenderState) PopClip ¶
func (rs *RenderState) PopClip()
PopClip pops Mask off the clip stack and set to current mask
func (*RenderState) PopXForm ¶
func (rs *RenderState) PopXForm()
PopXForm pops xform off the stack and set to current xform must protect within render mutex lock (see Lock version)
func (*RenderState) PopXFormLock ¶
func (rs *RenderState) PopXFormLock()
PopXFormLock pops xform off the stack and set to current xform protects within render mutex lock (see Lock version)
func (*RenderState) PushBounds ¶
func (rs *RenderState) PushBounds(b image.Rectangle)
PushBounds pushes current bounds onto stack and set new bounds this is the essential first step in rendering! any further actual rendering should always be surrounded by Lock() / Unlock() calls
func (*RenderState) PushClip ¶
func (rs *RenderState) PushClip()
PushClip pushes current Mask onto the clip stack
func (*RenderState) PushXForm ¶
func (rs *RenderState) PushXForm(xf mat32.Mat2)
PushXForm pushes current xform onto stack and apply new xform on top of it must protect within render mutex lock (see Lock version)
func (*RenderState) PushXFormLock ¶
func (rs *RenderState) PushXFormLock(xf mat32.Mat2)
PushXFormLock pushes current xform onto stack and apply new xform on top of it protects within render mutex lock
func (*RenderState) RestorePaint ¶
func (rs *RenderState) RestorePaint()
RestorePaint restores style settings from PaintBack to Paint
func (*RenderState) Unlock ¶
func (rs *RenderState) Unlock()
Unlock unlocks the render mutex, locked with PushBounds -- call this prior to children rendering etc.
type RowCol ¶
type RowCol int32
row / col for grid data
func (*RowCol) FromString ¶
func (RowCol) MarshalJSON ¶
func (*RowCol) UnmarshalJSON ¶
type RuneRender ¶
type RuneRender struct { Face font.Face `` /* 157-byte string literal not displayed */ Color color.Color `json:"-" xml:"-" desc:"color to draw characters in"` BgColor color.Color `` /* 233-byte string literal not displayed */ Deco TextDecorations `` /* 217-byte string literal not displayed */ RelPos mat32.Vec2 `desc:"relative position from start of TextRender for the lower-left baseline rendering position of the font character"` Size mat32.Vec2 `desc:"size of the rune itself, exclusive of spacing that might surround it"` RotRad float32 `desc:"rotation in radians for this character, relative to its lower-left baseline rendering position"` ScaleX float32 `desc:"scaling of the X dimension, in case of non-uniform scaling, 0 = no separate scaling"` }
RuneRender contains fully explicit data needed for rendering a single rune -- Face and Color can be nil after first element, in which case the last non-nil is used -- likely slightly more efficient to avoid setting all those pointers -- float32 values used to support better accuracy when transforming points
func (*RuneRender) CurColor ¶
func (rr *RuneRender) CurColor(curColor color.Color) color.Color
CurColor is convenience for updating current color if non-nil
func (*RuneRender) CurFace ¶
func (rr *RuneRender) CurFace(curFace font.Face) font.Face
CurFace is convenience for updating current font face if non-nil
func (*RuneRender) HasNil ¶
func (rr *RuneRender) HasNil() error
HasNil returns error if any of the key info (face, color) is nil -- only the first element must be non-nil
func (*RuneRender) RelPosAfterLR ¶
func (rr *RuneRender) RelPosAfterLR() float32
RelPosAfterLR returns the relative position after given rune for LR order: RelPos.X + Size.X
func (*RuneRender) RelPosAfterRL ¶
func (rr *RuneRender) RelPosAfterRL() float32
RelPosAfterRL returns the relative position after given rune for RL order: RelPos.X - Size.X
func (*RuneRender) RelPosAfterTB ¶
func (rr *RuneRender) RelPosAfterTB() float32
RelPosAfterTB returns the relative position after given rune for TB order: RelPos.Y + Size.Y
type ScreenPrefs ¶
type ScreenPrefs struct {
LogicalDPIScale float32 `` /* 295-byte string literal not displayed */
}
ScreenPrefs are the per-screen preferences -- see oswin/App/Screen() for info on the different screens -- these prefs are indexed by the Screen.Name -- settings here override those in the global preferences.
type ScrollBar ¶
type ScrollBar struct {
SliderBase
}
ScrollBar has a proportional thumb size reflecting amount of content visible
func AddNewScrollBar ¶ added in v0.9.7
AddNewScrollBar adds a new scrollbar to given parent node, with given name.
func (*ScrollBar) ConnectEvents2D ¶
func (sb *ScrollBar) ConnectEvents2D()
func (*ScrollBar) CopyFieldsFrom ¶ added in v0.9.8
func (sb *ScrollBar) CopyFieldsFrom(frm interface{})
func (*ScrollBar) FocusChanged2D ¶
func (sb *ScrollBar) FocusChanged2D(change FocusChanges)
func (*ScrollBar) Render2DDefaultStyle ¶
func (sb *ScrollBar) Render2DDefaultStyle()
render using a default style if not otherwise styled
type Separator ¶
type Separator struct { WidgetBase Horiz bool `xml:"horiz" desc:"is this a horizontal separator -- otherwise vertical"` }
Separator draws a vertical or horizontal line
func AddNewSeparator ¶ added in v0.9.7
AddNewSeparator adds a new separator to given parent node, with given name and Horiz (else Vert).
func (*Separator) CopyFieldsFrom ¶ added in v0.9.9
func (sp *Separator) CopyFieldsFrom(frm interface{})
type ShadowStyle ¶
type ShadowStyle struct { HOffset units.Value `xml:".h-offset" desc:"prop: .h-offset = horizontal offset of shadow -- positive = right side, negative = left side"` VOffset units.Value `xml:".v-offset" desc:"prop: .v-offset = vertical offset of shadow -- positive = below, negative = above"` Blur units.Value `xml:".blur" desc:"prop: .blur = blur radius -- higher numbers = more blurry"` Spread units.Value `xml:".spread" desc:"prop: .spread = spread radius -- positive number increases size of shadow, negative decreases size"` Color Color `xml:".color" desc:"prop: .color = color of the shadow"` Inset bool `xml:".inset" desc:"prop: .inset = shadow is inset within box instead of outset outside of box"` }
style parameters for shadows
func (*ShadowStyle) HasShadow ¶
func (s *ShadowStyle) HasShadow() bool
func (*ShadowStyle) ToDots ¶ added in v0.9.8
func (bs *ShadowStyle) ToDots(uc *units.Context)
ToDots runs ToDots on unit values, to compile down to raw pixels
type Shortcuts ¶
Shortcuts is a map between a key chord and a specific Action that can be triggered. This mapping must be unique, in that each chord has unique Action, and generally each Action only has a single chord as well, though this is not strictly enforced. Shortcuts are evaluated *after* the standard KeyMap event processing, so any conflicts are resolved in favor of the local widget's key event processing, with the shortcut only operating when no conflicting widgets are in focus. Shortcuts are always window-wide and are intended for global window / toolbar actions. Widget-specific key functions should be handled directly within widget key event processing.
type SizePrefs ¶
type SizePrefs struct { Need mat32.Vec2 `desc:"minimum size needed -- set to at least computed allocsize"` Pref mat32.Vec2 `desc:"preferred size -- start here for layout"` Max mat32.Vec2 `desc:"maximum size -- will not be greater than this -- 0 = no constraint, neg = stretch"` }
SizePrefs represents size preferences
func (SizePrefs) CanStretchNeed ¶
return true if Pref > Need meaning can stretch more along given dimension
type SliceLabeler ¶ added in v0.9.8
type SliceLabeler interface { // ElemLabel returns a GUI-appropriate label for slice element at given index ElemLabel(idx int) string }
SliceLabeler interface provides a GUI-appropriate label for a slice item, given an index into the slice.
type Slider ¶
type Slider struct {
SliderBase
}
Slider is a standard value slider with a fixed-sized thumb knob -- if an Icon is set, it is used for the knob of the slider
func AddNewSlider ¶ added in v0.9.7
AddNewSlider adds a new slider to given parent node, with given name.
func (*Slider) ConnectEvents2D ¶
func (sr *Slider) ConnectEvents2D()
func (*Slider) CopyFieldsFrom ¶ added in v0.9.8
func (sr *Slider) CopyFieldsFrom(frm interface{})
func (*Slider) FocusChanged2D ¶
func (sr *Slider) FocusChanged2D(change FocusChanges)
func (*Slider) Render2DDefaultStyle ¶
func (sr *Slider) Render2DDefaultStyle()
render using a default style if not otherwise styled
type SliderBase ¶
type SliderBase struct { PartsWidgetBase Value float32 `xml:"value" desc:"current value"` EmitValue float32 `copy:"-" xml:"-" json:"-" desc:"previous emitted value - don't re-emit if it is the same"` Min float32 `xml:"min" desc:"minimum value in range"` Max float32 `xml:"max" desc:"maximum value in range"` Step float32 `xml:"step" desc:"smallest step size to increment"` PageStep float32 `xml:"pagestep" desc:"larger PageUp / Dn step size"` Size float32 `xml:"size" desc:"size of the slide box in the relevant dimension -- range of motion -- exclusive of spacing"` ThSize float32 `` /* 211-byte string literal not displayed */ ThSizeReal float32 `` /* 141-byte string literal not displayed */ ThumbSize units.Value `xml:"thumb-size" desc:"styled fixed size of the thumb"` Prec int `` /* 212-byte string literal not displayed */ Icon IconName `view:"show-name" desc:"optional icon for the dragging knob"` ValThumb bool `` /* 268-byte string literal not displayed */ ThumbVal float32 `xml:"thumb-val" desc:"value that the thumb represents, in the same units"` Pos float32 `xml:"-" desc:"logical position of the slider relative to Size"` DragPos float32 `xml:"-" desc:"underlying drag position of slider -- not subject to snapping"` Dim mat32.Dims `desc:"dimension along which the slider slides"` Tracking bool `` /* 182-byte string literal not displayed */ TrackThr float32 `xml:"track-thr" desc:"threshold for amount of change in scroll value before emitting a signal in Tracking mode"` Snap bool `xml:"snap" desc:"snap the values to Step size increments"` Off bool `desc:"can turn off e.g., scrollbar rendering with this flag -- just prevents rendering"` State SliderStates `json:"-" xml:"-" desc:"state of slider"` StateStyles [SliderStatesN]Style `` /* 246-byte string literal not displayed */ SliderSig ki.Signal `copy:"-" json:"-" xml:"-" view:"-" desc:"signal for slider -- see SliderSignals for the types"` }
SliderBase has common slider functionality -- two major modes: ValThumb = false is a slider with a fixed-size thumb knob, while = true has a thumb that represents a value, as in a scrollbar, and the scrolling range is size - thumbsize
func (*SliderBase) ConfigParts ¶
func (sb *SliderBase) ConfigParts()
func (*SliderBase) ConfigPartsIfNeeded ¶
func (sb *SliderBase) ConfigPartsIfNeeded(render bool)
func (*SliderBase) CopyFieldsFrom ¶ added in v0.9.8
func (sb *SliderBase) CopyFieldsFrom(frm interface{})
func (*SliderBase) Defaults ¶
func (sb *SliderBase) Defaults()
func (*SliderBase) Disconnect ¶ added in v0.9.8
func (sb *SliderBase) Disconnect()
func (*SliderBase) Init2DSlider ¶
func (sb *SliderBase) Init2DSlider()
func (*SliderBase) KeyChordEvent ¶
func (sb *SliderBase) KeyChordEvent()
func (*SliderBase) KeyInput ¶
func (sb *SliderBase) KeyInput(kt *key.ChordEvent)
func (*SliderBase) MouseDragEvent ¶
func (sb *SliderBase) MouseDragEvent()
func (*SliderBase) MouseEvent ¶
func (sb *SliderBase) MouseEvent()
func (*SliderBase) MouseFocusEvent ¶
func (sb *SliderBase) MouseFocusEvent()
func (*SliderBase) MouseScrollEvent ¶
func (sb *SliderBase) MouseScrollEvent()
func (*SliderBase) PointToRelPos ¶
func (sb *SliderBase) PointToRelPos(pt image.Point) image.Point
PointToRelPos translates a point in global pixel coords into relative position within node. This satisfies the SliderPositioner interface.
func (*SliderBase) SetSliderPos ¶
func (sb *SliderBase) SetSliderPos(pos float32)
SetSliderPos sets the position of the slider at the given position in pixels, and updates the corresponding Value based on that position.
func (*SliderBase) SetSliderState ¶
func (sb *SliderBase) SetSliderState(state SliderStates)
SetSliderState sets the slider state to given state, updates style
func (*SliderBase) SetThumbValue ¶
func (sb *SliderBase) SetThumbValue(val float32)
SetThumbValue sets the thumb value to given value and updates the thumb size -- for scrollbar-style sliders where the thumb size represents visible range
func (*SliderBase) SetValue ¶
func (sb *SliderBase) SetValue(val float32)
SetValue sets the value and updates the slider position, but does not emit an updated signal (see SetValueAction)
func (*SliderBase) SetValueAction ¶
func (sb *SliderBase) SetValueAction(val float32)
SetValueAction sets the value and updates the slider representation, and emits a changed signal
func (*SliderBase) SizeFromAlloc ¶
func (sb *SliderBase) SizeFromAlloc()
SizeFromAlloc gets size from allocation
func (*SliderBase) SliderEnterHover ¶
func (sb *SliderBase) SliderEnterHover()
SliderEnterHover slider starting hover
func (*SliderBase) SliderEvents ¶
func (sb *SliderBase) SliderEvents()
func (*SliderBase) SliderExitHover ¶
func (sb *SliderBase) SliderExitHover()
SliderExitHover called when slider exiting hover
func (*SliderBase) SliderMove ¶ added in v0.9.11
func (sb *SliderBase) SliderMove(start, end float32)
SliderMove called when slider moved along relevant axis
func (*SliderBase) SliderPress ¶ added in v0.9.11
func (sb *SliderBase) SliderPress(pos float32)
SliderPress sets the slider in the down state -- mouse clicked down but not yet up -- emits SliderPress signal
func (*SliderBase) SliderRelease ¶ added in v0.9.11
func (sb *SliderBase) SliderRelease()
SliderRelease called when the slider has just been released -- sends a released signal and returns state to normal, and emits clicked signal if if it was previously in pressed state
func (*SliderBase) SnapValue ¶
func (sb *SliderBase) SnapValue()
SnapValue snaps the value to step sizes if snap option is set
func (*SliderBase) StyleFromProps ¶ added in v0.9.11
func (sr *SliderBase) StyleFromProps(props ki.Props, vp *Viewport2D)
StyleFromProps styles Slider-specific fields from ki.Prop properties doesn't support inherit or default
func (*SliderBase) StyleSlider ¶ added in v0.9.11
func (sr *SliderBase) StyleSlider()
func (*SliderBase) StyleToDots ¶ added in v0.9.11
func (sr *SliderBase) StyleToDots(uc *units.Context)
ToDots runs ToDots on unit values, to compile down to raw pixels
func (*SliderBase) UpdatePosFromValue ¶
func (sb *SliderBase) UpdatePosFromValue()
UpdatePosFromValue updates the slider position based on the current Value
func (*SliderBase) UpdateThumbValSize ¶
func (sb *SliderBase) UpdateThumbValSize()
UpdateThumbValSize sets thumb size as proportion of min / max (e.sb., amount visible in scrollbar) -- max's out to full size
type SliderPositioner ¶ added in v0.9.11
type SliderPositioner interface { // PointToRelPos translates a point in global pixel coords into relative // position within node PointToRelPos(pt image.Point) image.Point }
SliderPositioner is a minor interface for functions related to computing slider positions. Needed for more complex sliders such as Splitters that do this computation in a different way.
type SliderSignals ¶
type SliderSignals int64
SliderSignals are signals that sliders can send
const ( // SliderValueChanged indicates that the value has changed -- if tracking // is enabled, then this tracks online changes -- otherwise only at the // end. The data on the signal is the float32 Value. SliderValueChanged SliderSignals = iota // SliderPressed means slider was pushed down but not yet up. SliderPressed // SliderReleased means the slider has been released after being pressed. SliderReleased // SliderMoved means the slider position has moved (low level move event). SliderMoved SliderSignalsN )
func (*SliderSignals) FromString ¶
func (i *SliderSignals) FromString(s string) error
func (SliderSignals) String ¶
func (i SliderSignals) String() string
type SliderStates ¶
type SliderStates int32
SliderStates are mutually-exclusive slider states -- determines appearance
const ( // normal state -- there but not being interacted with SliderActive SliderStates = iota // inactive -- not responsive SliderInactive // mouse is hovering over the slider SliderHover // slider is the focus -- will respond to keyboard input SliderFocus // slider is currently being pressed down SliderDown // use background-color here to fill in selected value of slider SliderValue // these styles define the overall box around slider -- typically no border and a white background -- needs a background to allow local re-rendering SliderBox // total number of slider states SliderStatesN )
func (*SliderStates) FromString ¶
func (i *SliderStates) FromString(s string) error
func (SliderStates) String ¶
func (i SliderStates) String() string
type Space ¶
type Space struct {
WidgetBase
}
Space adds a fixed sized (1 ch x 1 em by default) blank space to a layout -- set width / height property to change
func AddNewSpace ¶ added in v0.9.7
AddNewSpace adds a new space to given parent node, with given name.
func (*Space) CopyFieldsFrom ¶ added in v0.9.8
func (sp *Space) CopyFieldsFrom(frm interface{})
type SpanRender ¶
type SpanRender struct { Text []rune `desc:"text as runes"` Render []RuneRender `desc:"render info for each rune in one-to-one correspondence"` RelPos mat32.Vec2 `` /* 289-byte string literal not displayed */ LastPos mat32.Vec2 `` /* 241-byte string literal not displayed */ Dir TextDirections `desc:"where relevant, this is the (default, dominant) text direction for the span"` HasDeco TextDecorations `desc:"mask of decorations that have been set on this span -- optimizes rendering passes"` }
SpanRender contains fully explicit data needed for rendering a span of text as a slice of runes, with rune and RuneRender elements in one-to-one correspondence (but any nil values will use prior non-nil value -- first rune must have all non-nil). Text can be oriented in any direction -- the only constraint is that it starts from a single starting position. Typically only text within a span will obey kerning. In standard TextRender context, each span is one line of text -- should not have new lines within the span itself. In SVG special cases (e.g., TextPath), it can be anything. It is NOT synonymous with the HTML <span> tag, as many styling applications of that tag can be accommodated within a larger span-as-line. The first RuneRender RelPos for LR text should be at X=0 (LastPos = 0 for RL) -- i.e., relpos positions are minimal for given span.
func (*SpanRender) AppendRune ¶
func (sr *SpanRender) AppendRune(r rune, face font.Face, clr, bg color.Color, deco TextDecorations)
AppendRune adds one rune and associated formatting info
func (*SpanRender) AppendString ¶
func (sr *SpanRender) AppendString(str string, face font.Face, clr, bg color.Color, deco TextDecorations, sty *FontStyle, ctxt *units.Context)
AppendString adds string and associated formatting info, optimized with only first rune having non-nil face and color settings
func (*SpanRender) FindWrapPosLR ¶
func (sr *SpanRender) FindWrapPosLR(trgSize, curSize float32) int
FindWrapPosLR finds a position to do word wrapping to fit within trgSize -- RelPos positions must have already been set (e.g., SetRunePosLR)
func (*SpanRender) HasDecoUpdate ¶
func (sr *SpanRender) HasDecoUpdate(bg color.Color, deco TextDecorations)
AppendRune adds one rune and associated formatting info
func (*SpanRender) Init ¶
func (sr *SpanRender) Init(capsz int)
Init initializes a new span with given capacity
func (*SpanRender) IsNewPara ¶
func (sr *SpanRender) IsNewPara() bool
IsNewPara returns true if this span starts a new paragraph
func (*SpanRender) IsValid ¶
func (sr *SpanRender) IsValid() error
IsValid ensures that at least some text is represented and the sizes of Text and Render slices are the same, and that the first render info is non-nil
func (*SpanRender) LastFont ¶
func (sr *SpanRender) LastFont() (face font.Face, color color.Color)
LastFont finds the last font and color from given span
func (*SpanRender) RenderBg ¶
func (sr *SpanRender) RenderBg(rs *RenderState, tpos mat32.Vec2)
RenderBg renders the background behind chars
func (*SpanRender) RenderLine ¶
func (sr *SpanRender) RenderLine(rs *RenderState, tpos mat32.Vec2, deco TextDecorations, ascPct float32)
RenderLine renders overline or line-through -- anything that is a function of ascent
func (*SpanRender) RenderUnderline ¶
func (sr *SpanRender) RenderUnderline(rs *RenderState, tpos mat32.Vec2)
RenderUnderline renders the underline for span -- ensures continuity to do it all at once
func (*SpanRender) RuneEndPos ¶
func (sr *SpanRender) RuneEndPos(idx int) mat32.Vec2
RuneEndPos returns the relative ending position of the given rune index (adds Span RelPos and rune RelPos + rune Size.X for LR writing). If index > length, then uses LastPos
func (*SpanRender) RuneRelPos ¶
func (sr *SpanRender) RuneRelPos(idx int) mat32.Vec2
RuneRelPos returns the relative (starting) position of the given rune index (adds Span RelPos and rune RelPos) -- this is typically the baseline position where rendering will start, not the upper left corner. if index > length, then uses LastPos
func (*SpanRender) SetNewPara ¶
func (sr *SpanRender) SetNewPara()
SetNewPara sets this as starting a new paragraph
func (*SpanRender) SetRenders ¶
func (sr *SpanRender) SetRenders(sty *FontStyle, ctxt *units.Context, noBG bool, rot, scalex float32)
SetRenders sets rendering parameters based on style
func (*SpanRender) SetRunePosLR ¶
func (sr *SpanRender) SetRunePosLR(letterSpace, wordSpace, chsz float32, tabSize int)
SetRunePosLR sets relative positions of each rune using a flat left-to-right text layout, based on font size info and additional extra letter and word spacing parameters (which can be negative)
func (*SpanRender) SetRunePosTB ¶ added in v0.9.9
func (sr *SpanRender) SetRunePosTB(letterSpace, wordSpace, chsz float32, tabSize int)
SetRunePosTB sets relative positions of each rune using a flat top-to-bottom text layout -- i.e., letters are in their normal upright orientation, but arranged vertically.
func (*SpanRender) SetRunePosTBRot ¶ added in v0.9.9
func (sr *SpanRender) SetRunePosTBRot(letterSpace, wordSpace, chsz float32, tabSize int)
SetRunePosTBRot sets relative positions of each rune using a flat top-to-bottom text layout, with characters rotated 90 degress based on font size info and additional extra letter and word spacing parameters (which can be negative)
func (*SpanRender) SetRunes ¶
func (sr *SpanRender) SetRunes(str []rune, sty *FontStyle, ctxt *units.Context, noBG bool, rot, scalex float32)
SetRunes initializes to given plain rune string, with given default style parameters that are set for the first render element -- constructs Render slice of same size as Text
func (*SpanRender) SetString ¶
func (sr *SpanRender) SetString(str string, sty *FontStyle, ctxt *units.Context, noBG bool, rot, scalex float32)
SetString initializes to given plain text string, with given default style parameters that are set for the first render element -- constructs Render slice of same size as Text
func (*SpanRender) SizeHV ¶
func (sr *SpanRender) SizeHV() mat32.Vec2
SizeHV computes the size of the text span from the first char to the last position, which is valid for purely horizontal or vertical text lines -- either X or Y will be zero depending on orientation
func (*SpanRender) SplitAtLR ¶
func (sr *SpanRender) SplitAtLR(idx int) *SpanRender
SplitAt splits current span at given index, returning a new span with remainder after index -- space is trimmed from both spans and relative positions updated, for LR direction
func (*SpanRender) TrimSpaceLR ¶
func (sr *SpanRender) TrimSpaceLR()
TrimSpace trims leading and trailing space elements from span, and updates the relative positions accordingly, for LR direction
func (*SpanRender) TrimSpaceLeftLR ¶
func (sr *SpanRender) TrimSpaceLeftLR()
TrimSpaceLeft trims leading space elements from span, and updates the relative positions accordingly, for LR direction
func (*SpanRender) TrimSpaceRightLR ¶
func (sr *SpanRender) TrimSpaceRightLR()
TrimSpaceRight trims trailing space elements from span, and updates the relative positions accordingly, for LR direction
func (*SpanRender) ZeroPosLR ¶
func (sr *SpanRender) ZeroPosLR()
ZeroPos ensures that the positions start at 0, for LR direction
type Spell ¶ added in v0.9.14
type Spell struct { ki.Node SrcLn int `desc:"line number in source that spelling is operating on, if relevant"` SrcCh int `desc:"character position in source that spelling is operating on (start of word to be corrected)"` Suggest []string `desc:"list of suggested corrections"` Word string `desc:"word being checked"` SpellSig ki.Signal `json:"-" xml:"-" view:"-" desc:"signal for Spell -- see SpellSignals for the types"` Correction string `desc:"the user's correction selection'"` Vp *Viewport2D `desc:"the viewport where the current popup menu is presented"` }
Spell
func (*Spell) Cancel ¶ added in v0.9.14
Cancel cancels any pending spell correction -- call when new events nullify prior correction returns true if canceled
func (*Spell) CheckWordInline ¶ added in v0.9.14
CheckWordInLine checks the model to determine if the word is known. automatically checks the Ignore list first.
func (*Spell) Disconnect ¶ added in v0.9.14
func (sc *Spell) Disconnect()
func (*Spell) IgnoreAllInline ¶ added in v0.9.14
func (sc *Spell) IgnoreAllInline()
IgnoreAllInline adds the word to the ignore list
func (*Spell) KeyInput ¶ added in v0.9.14
KeyInput is the opportunity for the spelling correction popup to act on specific key inputs
func (*Spell) LearnWordInline ¶ added in v0.9.14
func (sc *Spell) LearnWordInline()
LearnWordInline gets the misspelled/unknown word and passes to LearnWord
func (*Spell) Show ¶ added in v0.9.14
func (sc *Spell) Show(text string, vp *Viewport2D, pt image.Point)
Show is the main call for listing spelling corrections. Calls ShowNow which builds the correction popup menu Similar to completion.Show but does not use a timer Displays popup immediately for any unknown word
type SpellSignals ¶
type SpellSignals int64
SpellSignals are signals that are sent by Spell
const ( // SpellSelect means the user chose one of the possible corrections SpellSelect SpellSignals = iota // SpellIgnore signals the user chose ignore so clear the tag SpellIgnore )
func (*SpellSignals) FromString ¶
func (i *SpellSignals) FromString(s string) error
func (SpellSignals) String ¶
func (i SpellSignals) String() string
type SpinBox ¶
type SpinBox struct { PartsWidgetBase Value float32 `xml:"value" desc:"current value"` HasMin bool `xml:"has-min" desc:"is there a minimum value to enforce"` Min float32 `xml:"min" desc:"minimum value in range"` HasMax bool `xml:"has-max" desc:"is there a maximumvalue to enforce"` Max float32 `xml:"max" desc:"maximum value in range"` Step float32 `xml:"step" desc:"smallest step size to increment"` PageStep float32 `xml:"pagestep" desc:"larger PageUp / Dn step size"` Prec int `` /* 201-byte string literal not displayed */ Format string `` /* 208-byte string literal not displayed */ UpIcon IconName `view:"show-name" desc:"icon to use for up button -- defaults to wedge-up"` DownIcon IconName `view:"show-name" desc:"icon to use for down button -- defaults to wedge-down"` SpinBoxSig ki.Signal `copy:"-" json:"-" xml:"-" view:"-" desc:"signal for spin box -- has no signal types, just emitted when the value changes"` }
SpinBox combines a TextField with up / down buttons for incrementing / decrementing values -- all configured within the Parts of the widget
func AddNewSpinBox ¶ added in v0.9.7
AddNewSpinBox adds a new spinbox to given parent node, with given name.
func (*SpinBox) ConfigParts ¶
func (sb *SpinBox) ConfigParts()
func (*SpinBox) ConfigPartsIfNeeded ¶
func (sb *SpinBox) ConfigPartsIfNeeded()
func (*SpinBox) ConnectEvents2D ¶
func (sb *SpinBox) ConnectEvents2D()
func (*SpinBox) CopyFieldsFrom ¶ added in v0.9.8
func (sb *SpinBox) CopyFieldsFrom(frm interface{})
func (*SpinBox) Disconnect ¶ added in v0.9.8
func (sb *SpinBox) Disconnect()
func (*SpinBox) FormatIsInt ¶ added in v0.9.11
FormatIsInt returns true if the format string requires an integer value
func (*SpinBox) HasFocus2D ¶
func (*SpinBox) IncrValue ¶
IncrValue increments the value by given number of steps (+ or -), and enforces it to be an even multiple of the step size (snap-to-value), and emits the signal
func (*SpinBox) MouseScrollEvent ¶
func (sb *SpinBox) MouseScrollEvent()
func (*SpinBox) SetValueAction ¶
SetValueAction calls SetValue and also emits the signal
func (*SpinBox) SpinBoxEvents ¶
func (sb *SpinBox) SpinBoxEvents()
func (*SpinBox) StringToVal ¶ added in v0.9.11
StringToVal converts the string field back to float value
func (*SpinBox) StyleFromProps ¶ added in v0.9.11
func (sb *SpinBox) StyleFromProps(props ki.Props, vp *Viewport2D)
StyleFromProps styles SpinBox-specific fields from ki.Prop properties doesn't support inherit or default
func (*SpinBox) StyleSpinBox ¶
func (sb *SpinBox) StyleSpinBox()
func (*SpinBox) TextFieldEvent ¶
func (sb *SpinBox) TextFieldEvent()
func (*SpinBox) ValToString ¶ added in v0.9.11
ValToString converts the value to the string representation thereof
type SplitView ¶
type SplitView struct { PartsWidgetBase HandleSize units.Value `` /* 158-byte string literal not displayed */ Splits []float32 `desc:"proportion (0-1 normalized, enforced) of space allocated to each element -- can enter 0 to collapse a given element"` SavedSplits []float32 `desc:"A saved version of the splits which can be restored -- for dynamic collapse / expand operations"` Dim mat32.Dims `desc:"dimension along which to split the space"` }
SplitView allocates a fixed proportion of space to each child, along given dimension, always using only the available space given to it by its parent (i.e., it will force its children, which should be layouts (typically Frame's), to have their own scroll bars as necessary). It should generally be used as a main outer-level structure within a window, providing a framework for inner elements -- it allows individual child elements to update independently and thus is important for speeding update performance. It uses the Widget Parts to hold the splitter widgets separately from the children that contain the rest of the scenegraph to be displayed within each region.
func AddNewSplitView ¶ added in v0.9.7
AddNewSplitView adds a new splitview to given parent node, with given name.
func (*SplitView) CollapseChild ¶
CollapseChild collapses given child(ren) (sets split proportion to 0), optionally saving the prior splits for later Restore function -- does an Update -- triggered by double-click of splitter
func (*SplitView) ConfigSplitters ¶
func (sv *SplitView) ConfigSplitters()
func (*SplitView) ConnectEvents2D ¶
func (sv *SplitView) ConnectEvents2D()
func (*SplitView) CopyFieldsFrom ¶ added in v0.9.8
func (sv *SplitView) CopyFieldsFrom(frm interface{})
func (*SplitView) EvenSplits ¶
func (sv *SplitView) EvenSplits()
EvenSplits splits space evenly across all panels
func (*SplitView) HasFocus2D ¶
func (*SplitView) IsCollapsed ¶ added in v0.9.11
IsCollapsed returns true if given split number is collapsed
func (*SplitView) KeyChordEvent ¶
func (sv *SplitView) KeyChordEvent()
func (*SplitView) KeyInput ¶
func (sv *SplitView) KeyInput(kt *key.ChordEvent)
func (*SplitView) RestoreChild ¶
RestoreChild restores given child(ren) -- does an Update
func (*SplitView) RestoreSplits ¶
func (sv *SplitView) RestoreSplits()
RestoreSplits restores a previously-saved set of splits (if it exists), does an update
func (*SplitView) SaveSplits ¶
func (sv *SplitView) SaveSplits()
SaveSplits saves the current set of splits in SavedSplits, for a later RestoreSplits
func (*SplitView) SetSplitAction ¶
SetSplitAction sets the new splitter value, for given splitter -- new value is 0..1 value of position of that splitter -- it is a sum of all the positions up to that point. Splitters are updated to ensure that selected position is achieved, while dividing remainder appropriately.
func (*SplitView) SetSplits ¶
SetSplits sets the split proportions -- can use 0 to hide / collapse a child entirely -- just does the basic local update start / end use SetSplitsAction to trigger full rebuild which is typically required
func (*SplitView) SetSplitsAction ¶
SetSplitsAction sets the split proportions -- can use 0 to hide / collapse a child entirely -- does full rebuild at level of viewport
func (*SplitView) SetSplitsList ¶ added in v0.9.7
SetSplitsList sets the split proportions using a list (slice) argument, instead of variable args -- e.g., for Python or other external users. can use 0 to hide / collapse a child entirely -- just does the basic local update start / end -- use SetSplitsAction to trigger full rebuild which is typically required
func (*SplitView) SplitViewEvents ¶
func (sv *SplitView) SplitViewEvents()
func (*SplitView) StyleSplitView ¶
func (sv *SplitView) StyleSplitView()
func (*SplitView) UpdateSplits ¶
func (sv *SplitView) UpdateSplits()
UpdateSplits updates the splits to be same length as number of children, and normalized
type Splitter ¶
type Splitter struct { SliderBase SplitterNo int `desc:"splitter number this one is"` OrigWinBBox image.Rectangle `` /* 137-byte string literal not displayed */ }
Splitter provides the splitter handle and line separating two elements in a SplitView, with draggable resizing of the splitter -- parent is Parts layout of the SplitView -- based on SliderBase
func (*Splitter) ConfigPartsIfNeeded ¶
func (*Splitter) ConnectEvents2D ¶
func (sr *Splitter) ConnectEvents2D()
func (*Splitter) FocusChanged2D ¶
func (sr *Splitter) FocusChanged2D(change FocusChanges)
func (*Splitter) MouseEvent ¶ added in v0.9.11
func (sr *Splitter) MouseEvent()
func (*Splitter) MouseScrollEvent ¶ added in v1.0.0
func (sr *Splitter) MouseScrollEvent()
func (*Splitter) PointToRelPos ¶ added in v0.9.11
func (*Splitter) Render2DDefaultStyle ¶
func (sr *Splitter) Render2DDefaultStyle()
render using a default style if not otherwise styled
func (*Splitter) SplitterEvents ¶ added in v0.9.11
func (sr *Splitter) SplitterEvents()
func (*Splitter) UpdateSplitterPos ¶
func (sr *Splitter) UpdateSplitterPos()
type Sprite ¶ added in v0.9.8
type Sprite struct { On bool `desc:"whether this sprite is active now or not"` Name string `desc:"unique name of sprite"` Geom Geom2DInt `desc:"position and size of the image within the overlay window texture"` Pixels *image.RGBA `desc:"pixels to render -- should be same size as Geom.Size"` Bg *image.RGBA `desc:"optional background image which is rendered first before IMage"` }
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 (*Sprite) GrabRenderFrom ¶ added in v0.9.8
GrabRenderFrom grabs the rendered image from given node
func (*Sprite) SetBottomPos ¶ added in v0.9.8
SetBottomPos sets the sprite's bottom position to given point the Geom.Pos represents its top position
type Stretch ¶
type Stretch struct {
WidgetBase
}
Stretch adds an infinitely stretchy element for spacing out layouts (max-size = -1) set the width / height property to determine how much it takes relative to other stretchy elements
func AddNewStretch ¶ added in v0.9.7
AddNewStretch adds a new stretch to given parent node, with given name.
func (*Stretch) CopyFieldsFrom ¶ added in v0.9.8
func (st *Stretch) CopyFieldsFrom(frm interface{})
type Stripes ¶
type Stripes int32
Stripes defines stripes options for elements that can render striped backgrounds
func (*Stripes) FromString ¶
func (Stripes) MarshalJSON ¶
func (*Stripes) UnmarshalJSON ¶
type StrokeStyle ¶
type StrokeStyle struct { On bool `desc:"is stroke active -- if property is none then false"` Color ColorSpec `xml:"stroke" desc:"prop: stroke = stroke color specification"` Opacity float32 `xml:"stroke-opacity" desc:"prop: stroke-opacity = global alpha opacity / transparency factor"` Width units.Value `xml:"stroke-width" desc:"prop: stroke-width = line width"` MinWidth units.Value `` /* 332-byte string literal not displayed */ Dashes []float64 `` /* 242-byte string literal not displayed */ Cap LineCaps `xml:"stroke-linecap" desc:"prop: stroke-linecap = how to draw the end cap of lines"` Join LineJoins `xml:"stroke-linejoin" desc:"prop: stroke-linejoin = how to join line segments"` MiterLimit float32 `xml:"stroke-miterlimit" min:"1" desc:"prop: stroke-miterlimit = limit of how far to miter -- must be 1 or larger"` }
StrokeStyle contains all the properties for painting a line
func (*StrokeStyle) Defaults ¶
func (ps *StrokeStyle) Defaults()
Defaults initializes default values for paint stroke
func (*StrokeStyle) SetColor ¶
func (ps *StrokeStyle) SetColor(cl color.Color)
SetColor sets a solid stroke color -- nil turns off stroking
func (*StrokeStyle) SetColorSpec ¶
func (ps *StrokeStyle) SetColorSpec(cl *ColorSpec)
SetColorSpec sets full color spec from source
func (*StrokeStyle) SetStylePost ¶
func (ps *StrokeStyle) SetStylePost(props ki.Props)
SetStylePost does some updating after setting the style from user properties
func (*StrokeStyle) ToDots ¶ added in v0.9.8
func (ss *StrokeStyle) ToDots(uc *units.Context)
ToDots runs ToDots on unit values, to compile down to raw pixels
type Style ¶
type Style struct { Template string `` /* 162-byte string literal not displayed */ Display bool `xml:"display" desc:"todo big enum of how to display item -- controls layout etc"` Visible bool `xml:"visible" desc:"is the item visible or not"` Inactive bool `xml:"inactive" desc:"make a control inactive so it does not respond to input"` Layout LayoutStyle `desc:"layout styles -- do not prefix with any xml"` Border BorderStyle `xml:"border" desc:"border around the box element -- todo: can have separate ones for different sides"` BoxShadow ShadowStyle `xml:"box-shadow" desc:"prop: box-shadow = type of shadow to render around box"` Font FontStyle `desc:"font parameters -- no xml prefix -- also has color, background-color"` Text TextStyle `desc:"text parameters -- no xml prefix"` Outline BorderStyle `xml:"outline" desc:"prop: outline = draw an outline around an element -- mostly same styles as border -- default to none"` PointerEvents bool `xml:"pointer-events" desc:"prop: pointer-events = does this element respond to pointer events -- default is true"` UnContext units.Context `xml:"-" desc:"units context -- parameters necessary for anchoring relative units"` IsSet bool `desc:"has this style been set from object values yet?"` PropsNil bool `desc:"set to true if parent node has no props -- allows optimization of styling"` // contains filtered or unexported fields }
Style has all the CSS-based style elements -- used for widget-type objects
var StyleDefault Style
StyleDefault is default style can be used when property specifies "default"
func (*Style) ApplyCSS ¶
ApplyCSS applies css styles for given node, using key to select sub-props from overall properties list, and optional selector to select a further :name selector within that key
func (*Style) BoxSpace ¶
BoxSpace returns extra space around the central content in the box model, in dots -- todo: must complicate this if we want different spacing on different sides box outside-in: margin | border | padding | content
func (*Style) CopyUnitContext ¶
CopyUnitContext copies unit context from another, update with our font info, and then cache everything out in terms of raw pixel dots for rendering -- call at start of render
func (*Style) FromTemplate ¶ added in v0.9.8
FromTemplate checks if there is a template for this style, returning false for hasTemplate if not (in which case usual styling should proceed). If there is a template, and it has already been saved, the style is copied from the existing template. If there is a template name set but no existing template has yet been saved, then saveTemplate = true and the SaveTemplate call should be made on this style after it has gone through the usual styling process.
func (*Style) InheritFields ¶
InheritFields from parent: Manual inheriting of values is much faster than automatic version!
func (*Style) SaveTemplate ¶ added in v0.9.8
func (s *Style) SaveTemplate()
SaveTemplate should only be called for styles that have template but none has yet been saved, as determined by FromTemplate call.
func (*Style) SetStyleProps ¶
func (s *Style) SetStyleProps(par *Style, props ki.Props, vp *Viewport2D)
SetStyleProps sets style values based on given property map (name: value pairs), inheriting elements as appropriate from parent
func (*Style) SetUnitContext ¶
func (s *Style) SetUnitContext(vp *Viewport2D, el mat32.Vec2)
SetUnitContext sets the unit context based on size of viewport and parent element (from bbox) and then cache everything out in terms of raw pixel dots for rendering -- call at start of render
func (*Style) StyleCSS ¶
StyleCSS applies css style properties to given Widget node, parsing out type, .class, and #name selectors, along with optional sub-selector (:hover, :active etc)
func (*Style) StyleFromProps ¶ added in v0.9.8
func (s *Style) StyleFromProps(par *Style, props ki.Props, vp *Viewport2D)
StyleFromProps sets style field values based on ki.Props properties
func (*Style) StyleToDots ¶ added in v0.9.8
StyleToDots runs ToDots on unit values, to compile down to raw pixels
func (*Style) Use ¶
func (s *Style) Use(vp *Viewport2D)
Use activates the style settings in this style for any general settings and parameters -- typically specific style values are used directly in particular rendering steps, but some settings also impact global variables, such as CurrentColor -- this is automatically called for a successful PushBounds in Node2DBase
type StyleFunc ¶ added in v0.9.8
type StyleFunc func(obj interface{}, key string, val interface{}, par interface{}, vp *Viewport2D)
type StyleSheet ¶
type StyleSheet struct { Node2DBase Sheet *css.Stylesheet }
StyleSheet is a Node2D node that contains a stylesheet -- property values contained in this sheet can be transformed into ki.Props and set in CSS field of appropriate node
func AddNewStyleSheet ¶ added in v0.9.7
func AddNewStyleSheet(parent ki.Ki, name string) *StyleSheet
AddNewStyleSheet adds a new CSS stylesheet to given parent node, with given name.
func (*StyleSheet) CSSProps ¶
func (ss *StyleSheet) CSSProps() ki.Props
CSSProps returns the properties for each of the rules in this style sheet, suitable for setting the CSS value of a node -- returns nil if empty sheet
func (*StyleSheet) ParseString ¶
func (ss *StyleSheet) ParseString(str string) error
ParseString parses the string into a StyleSheet of rules, which can then be used for extracting properties
type Styler ¶
type Styler interface {
Style() *Style
}
Styler defines an interface for anything that has a Style on it
type TabButton ¶
type TabButton struct { Action NoDelete bool `desc:"if true, this tab does not have the delete button avail"` }
TabButton is a larger select action and a small close action. Indicator icon is used for close icon.
func (*TabButton) ConfigParts ¶
func (tb *TabButton) ConfigParts()
func (*TabButton) ConfigPartsDeleteButton ¶ added in v0.9.11
func (tb *TabButton) ConfigPartsDeleteButton()
type TabView ¶
type TabView struct { Layout MaxChars int `desc:"maximum number of characters to include in tab label -- elides labels that are longer than that"` TabViewSig ki.Signal `copy:"-" json:"-" xml:"-" desc:"signal for tab widget -- see TabViewSignals for the types"` NewTabButton bool `desc:"show a new tab button at right of list of tabs"` NoDeleteTabs bool `desc:"if true, tabs are not user-deleteable"` NewTabType reflect.Type `desc:"type of widget to create in a new tab via new tab button -- Frame by default"` Mu sync.Mutex `` /* 157-byte string literal not displayed */ }
TabView switches among child widgets via tabs. The selected widget gets the full allocated space avail after the tabs are accounted for. The TabView is just a Vertical layout that manages two child widgets: a HorizFlow Layout for the tabs (which can flow across multiple rows as needed) and a Stacked Frame that actually contains all the children, and provides scrollbars as needed to any content within. Typically should have max stretch and a set preferred size, so it expands.
func AddNewTabView ¶ added in v0.9.7
AddNewTabView adds a new tabview to given parent node, with given name.
func (*TabView) AddNewTab ¶
AddNewTab adds a new widget as a new tab of given widget type, with given tab label, and returns the new widget
func (*TabView) AddNewTabAction ¶
AddNewTabAction adds a new widget as a new tab of given widget type, with given tab label, and returns the new widget -- emits TabAdded signal
func (*TabView) AddTab ¶
AddTab adds a widget as a new tab, with given tab label, and returns the index of that tab
func (*TabView) ConfigNewTabButton ¶
ConfigNewTabButton configures the new tab + button at end of list of tabs
func (*TabView) CopyFieldsFrom ¶ added in v0.9.8
func (tv *TabView) CopyFieldsFrom(frm interface{})
func (*TabView) DeleteTabIndex ¶
DeleteTabIndex deletes tab at given index, optionally calling destroy on tab contents -- returns widget if destroy == false, tab name, and bool success
func (*TabView) DeleteTabIndexAction ¶
DeleteTabIndexAction deletes tab at given index using destroy flag, and emits TabDeleted signal with name of deleted tab this is called by the delete button on the tab
func (*TabView) Disconnect ¶ added in v0.9.8
func (tv *TabView) Disconnect()
func (*TabView) InitTabView ¶
func (tv *TabView) InitTabView()
InitTabView initializes the tab widget children if it hasn't been done yet
func (*TabView) InsertNewTab ¶
InsertNewTab inserts a new widget of given type into given index position within list of tabs, and returns that new widget
func (*TabView) InsertTab ¶
InsertTab inserts a widget into given index position within list of tabs
func (*TabView) InsertTabOnlyAt ¶
InsertTabOnlyAt inserts just the tab at given index -- after panel has already been added to frame -- assumed to be wrapped in update. Generally for internal use.
func (*TabView) RecycleTab ¶ added in v0.9.11
RecycleTab returns a tab with given name, first by looking for an existing one, and if not found, making a new one with widget of given type. If sel, then select it. returns widget for tab.
func (*TabView) RenderTabSeps ¶
func (tv *TabView) RenderTabSeps()
RenderTabSeps renders the separators between tabs
func (*TabView) RenumberTabs ¶
func (tv *TabView) RenumberTabs()
RenumberTabs assigns proper index numbers to each tab
func (*TabView) SelectTabByName ¶
SelectTabByName selects tab by name, returning it.
func (*TabView) SelectTabByNameTry ¶ added in v0.9.7
SelectTabByNameTry selects tab by name, returning it. Returns error if not found.
func (*TabView) SelectTabIndex ¶
SelectTabIndex selects tab at given index, returning it -- returns false if index is invalid
func (*TabView) SelectTabIndexAction ¶
SelectTabIndexAction selects tab at given index and emits selected signal, with the index of the selected tab -- this is what is called when a tab is clicked
func (*TabView) TabAtIndex ¶
TabAtIndex returns content widget and tab button at given index, false if index out of range (emits log message)
func (*TabView) TabByName ¶
TabByName returns tab with given name (nil if not found -- see TabByNameTry)
func (*TabView) TabByNameTry ¶ added in v0.9.7
TabByNameTry returns tab with given name, and an error if not found.
func (*TabView) TabIndexByName ¶ added in v0.9.7
TabIndexByName returns tab index for given tab name, and an error if not found.
func (*TabView) UnselectOtherTabs ¶
UnselectOtherTabs turns off all the tabs except given one
type TabViewSignals ¶
type TabViewSignals int64
TabViewSignals are signals that the TabView can send
const ( // TabSelected indicates tab was selected -- data is the tab index TabSelected TabViewSignals = iota // TabAdded indicates tab was added -- data is the tab index TabAdded // TabDeleted indicates tab was deleted -- data is the tab name TabDeleted TabViewSignalsN )
func (*TabViewSignals) FromString ¶
func (i *TabViewSignals) FromString(s string) error
func (TabViewSignals) String ¶
func (i TabViewSignals) String() string
type TextAnchors ¶
type TextAnchors int32
TextAnchors are for direction of text writing, used in direction and writing-mode styles
const ( AnchorStart TextAnchors = iota AnchorMiddle AnchorEnd TextAnchorsN )
func (*TextAnchors) FromString ¶
func (i *TextAnchors) FromString(s string) error
func (TextAnchors) MarshalJSON ¶
func (ev TextAnchors) MarshalJSON() ([]byte, error)
func (TextAnchors) String ¶
func (i TextAnchors) String() string
func (*TextAnchors) UnmarshalJSON ¶
func (ev *TextAnchors) UnmarshalJSON(b []byte) error
type TextDecorations ¶
type TextDecorations int32
TextDecorations are underline, line-through, etc -- operates as bit flags -- also used for additional layout hints for RuneRender
const ( DecoNone TextDecorations = iota DecoUnderline DecoOverline DecoLineThrough // Blink is not currently supported (and probably a bad idea generally ;) DecoBlink // DottedUnderline is used for abbr tag -- otherwise not a standard text-decoration option afaik DecoDottedUnderline // DecoParaStart at start of a SpanRender indicates that it should be // styled as the start of a new paragraph and not just the start of a new // line DecoParaStart // DecoSuper indicates super-scripted text DecoSuper // DecoSub indicates sub-scripted text DecoSub // DecoBgColor indicates that a bg color has been set -- for use in optimizing rendering DecoBgColor TextDecorationsN )
func (*TextDecorations) FromString ¶
func (i *TextDecorations) FromString(s string) error
func (TextDecorations) MarshalJSON ¶
func (ev TextDecorations) MarshalJSON() ([]byte, error)
func (TextDecorations) String ¶
func (i TextDecorations) String() string
func (*TextDecorations) UnmarshalJSON ¶
func (ev *TextDecorations) UnmarshalJSON(b []byte) error
type TextDirections ¶
type TextDirections int32
TextDirections are for direction of text writing, used in direction and writing-mode styles
const ( LRTB TextDirections = iota RLTB TBRL LR RL TB LTR RTL TextDirectionsN )
func (*TextDirections) FromString ¶
func (i *TextDirections) FromString(s string) error
func (TextDirections) MarshalJSON ¶
func (ev TextDirections) MarshalJSON() ([]byte, error)
func (TextDirections) String ¶
func (i TextDirections) String() string
func (*TextDirections) UnmarshalJSON ¶
func (ev *TextDirections) UnmarshalJSON(b []byte) error
type TextField ¶
type TextField struct { PartsWidgetBase Txt string `json:"-" xml:"text" desc:"the last saved value of the text string being edited"` Placeholder string `json:"-" xml:"placeholder" desc:"text that is displayed when the field is empty, in a lower-contrast manner"` ClearAct bool `xml:"clear-act" desc:"add a clear action x at right side of edit, set from clear-act property (inherited) -- on by default"` CursorWidth units.Value `xml:"cursor-width" desc:"width of cursor -- set from cursor-width property (inherited)"` Edited bool `json:"-" xml:"-" desc:"true if the text has been edited relative to the original"` EditTxt []rune `json:"-" xml:"-" desc:"the live text string being edited, with latest modifications -- encoded as runes"` MaxWidthReq int `` /* 199-byte string literal not displayed */ EffSize mat32.Vec2 `copy:"-" json:"-" xml:"-" desc:"effective size, subtracting the close widget"` StartPos int `copy:"-" json:"-" xml:"-" desc:"starting display position in the string"` EndPos int `copy:"-" json:"-" xml:"-" desc:"ending display position in the string"` CursorPos int `copy:"-" json:"-" xml:"-" desc:"current cursor position"` CharWidth int `copy:"-" json:"-" xml:"-" desc:"approximate number of chars that can be displayed at any time -- computed from font size etc"` SelectStart int `copy:"-" json:"-" xml:"-" desc:"starting position of selection in the string"` SelectEnd int `copy:"-" json:"-" xml:"-" desc:"ending position of selection in the string"` SelectInit int `copy:"-" json:"-" xml:"-" desc:"initial selection position -- where it started"` SelectMode bool `copy:"-" json:"-" xml:"-" desc:"if true, select text as cursor moves"` TextFieldSig ki.Signal `copy:"-" json:"-" xml:"-" view:"-" desc:"signal for line edit -- see TextFieldSignals for the types"` RenderAll TextRender `copy:"-" json:"-" xml:"-" desc:"render version of entire text, for sizing"` RenderVis TextRender `copy:"-" json:"-" xml:"-" desc:"render version of just visible text"` StateStyles [TextFieldStatesN]Style `copy:"-" json:"-" xml:"-" desc:"normal style and focus style"` FontHeight float32 `copy:"-" json:"-" xml:"-" desc:"font height, cached during styling"` BlinkOn bool `copy:"-" json:"-" xml:"-" desc:"oscillates between on and off for blinking"` CursorMu sync.Mutex `copy:"-" json:"-" xml:"-" view:"-" desc:"mutex for updating cursor between blinker and field"` Complete *Complete `copy:"-" json:"-" xml:"-" desc:"functions and data for textfield completion"` }
TextField is a widget for editing a line of text
var BlinkingTextField *TextField
BlinkingTextField is the text field that is blinking
func AddNewTextField ¶ added in v0.9.7
AddNewTextField adds a new textfield to given parent node, with given name.
func (*TextField) AutoScroll ¶
func (tf *TextField) AutoScroll()
AutoScroll scrolls the starting position to keep the cursor visible
func (*TextField) CancelComplete ¶
func (tf *TextField) CancelComplete()
CancelComplete cancels any pending completion -- call this when new events have moved beyond any prior completion scenario
func (*TextField) CharStartPos ¶
CharStartPos returns the starting render coords for the given character position in string -- makes no attempt to rationalize that pos (i.e., if not in visible range, position will be out of range too). if wincoords is true, then adds window box offset -- for cursor, popups
func (*TextField) ClearCursor ¶
func (tf *TextField) ClearCursor()
ClearCursor turns off cursor and stops it from blinking
func (*TextField) ClearSelected ¶
func (tf *TextField) ClearSelected()
ClearSelected resets both the global selected flag and any current selection
func (*TextField) CompleteExtend ¶
CompleteExtend inserts the extended seed at the current cursor position
func (*TextField) CompleteText ¶
CompleteText edits the text field using the string chosen from the completion menu
func (*TextField) ConfigParts ¶
func (tf *TextField) ConfigParts()
func (*TextField) ConnectEvents2D ¶
func (tf *TextField) ConnectEvents2D()
func (*TextField) Copy ¶
Copy copies any selected text to the clipboard. Satisfies Clipper interface -- can be extended in subtypes. optionally resetting the current selection
func (*TextField) CopyFieldsFrom ¶ added in v0.9.8
func (tf *TextField) CopyFieldsFrom(frm interface{})
func (*TextField) CursorBackspace ¶
CursorBackspace deletes character(s) immediately before cursor
func (*TextField) CursorBackward ¶
CursorBackward moves the cursor backward
func (*TextField) CursorDelete ¶
CursorDelete deletes character(s) immediately after the cursor
func (*TextField) CursorEnd ¶
func (tf *TextField) CursorEnd()
CursorEnd moves the cursor to the end of the text
func (*TextField) CursorForward ¶
CursorForward moves the cursor forward
func (*TextField) CursorKill ¶
func (tf *TextField) CursorKill()
CursorKill deletes text from cursor to end of text
func (*TextField) CursorSprite ¶
CursorSprite returns the Sprite for the cursor (which is only rendered once with a vertical bar, and just activated and inactivated depending on render status)
func (*TextField) CursorStart ¶
func (tf *TextField) CursorStart()
CursorStart moves the cursor to the start of the text, updating selection if select mode is active
func (*TextField) Cut ¶
func (tf *TextField) Cut()
Cut cuts any selected text and adds it to the clipboard
func (*TextField) DeleteSelection ¶
DeleteSelection deletes any selected text, without adding to clipboard -- returns text deleted
func (*TextField) Disconnect ¶ added in v0.9.8
func (tf *TextField) Disconnect()
func (*TextField) EditDeFocused ¶
func (tf *TextField) EditDeFocused()
EditDeFocused completes editing and copies the active edited text to the text -- called when field is made inactive due to interactions elsewhere.
func (*TextField) EditDone ¶
func (tf *TextField) EditDone()
EditDone completes editing and copies the active edited text to the text -- called when the return key is pressed or goes out of focus
func (*TextField) FocusChanged2D ¶
func (tf *TextField) FocusChanged2D(change FocusChanges)
func (*TextField) HandleMouseEvent ¶
HandleMouseEvent handles the mouse.Event
func (*TextField) HasSelection ¶
HasSelection returns whether there is a selected region of text
func (*TextField) InsertAtCursor ¶
InsertAtCursor inserts given text at current cursor position
func (*TextField) IsFocusActive ¶
IsFocusActive returns true if we have active focus for keyboard input
func (*TextField) IsWordBreak ¶
IsWordBreak defines what counts as a word break for the purposes of selecting words
func (*TextField) KeyChordEvent ¶
func (tf *TextField) KeyChordEvent()
func (*TextField) KeyInput ¶
func (tf *TextField) KeyInput(kt *key.ChordEvent)
KeyInput handles keyboard input into the text field and from the completion menu
func (*TextField) MakeContextMenu ¶
func (*TextField) MimeData ¶ added in v0.9.11
MimeData adds selection to mimedata. Satisfies Clipper interface -- can be extended in subtypes.
func (*TextField) MouseDragEvent ¶
func (tf *TextField) MouseDragEvent()
func (*TextField) MouseEvent ¶
func (tf *TextField) MouseEvent()
func (*TextField) MouseFocusEvent ¶
func (tf *TextField) MouseFocusEvent()
func (*TextField) OfferComplete ¶
OfferComplete pops up a menu of possible completions
func (*TextField) Paste ¶
func (tf *TextField) Paste()
Paste inserts text from the clipboard at current cursor position -- if cursor is within a current selection, that selection is replaced. Satisfies Clipper interface -- can be extended in subtypes.
func (*TextField) PixelToCursor ¶
PixelToCursor finds the cursor position that corresponds to the given pixel location
func (*TextField) RenderCursor ¶
RenderCursor renders the cursor on or off, as a sprite that is either on or off
func (*TextField) RenderSelect ¶
func (tf *TextField) RenderSelect()
RenderSelect renders the selected region, if any, underneath the text
func (*TextField) Revert ¶
func (tf *TextField) Revert()
Revert aborts editing and reverts to last saved text
func (*TextField) ScrollLayoutToCursor ¶
ScrollLayoutToCursor scrolls any scrolling layout above us so that the cursor is in view
func (*TextField) SelectModeToggle ¶
func (tf *TextField) SelectModeToggle()
SelectModeToggle toggles the SelectMode, updating selection with cursor movement
func (*TextField) SelectRegUpdate ¶
SelectRegUpdate updates current select region based on given cursor position relative to SelectStart position
func (*TextField) SelectUpdate ¶
func (tf *TextField) SelectUpdate()
SelectUpdate updates the select region after any change to the text, to keep it in range
func (*TextField) SelectWord ¶
func (tf *TextField) SelectWord()
SelectWord selects the word (whitespace delimited) that the cursor is on
func (*TextField) SetCompleter ¶
func (tf *TextField) SetCompleter(data interface{}, matchFun complete.MatchFunc, editFun complete.EditFunc)
SetCompleter sets completion functions so that completions will automatically be offered as the user types
func (*TextField) SetCursorFromPixel ¶
func (tf *TextField) SetCursorFromPixel(pixOff float32, selMode mouse.SelectModes)
SetCursorFromPixel finds cursor location from pixel offset relative to WinBBox of text field, and sets current cursor to it, updating selection as well
func (*TextField) SetText ¶
SetText sets the text to be edited and reverts any current edit to reflect this new text
func (*TextField) StartCharPos ¶
StartCharPos returns the starting position of the given rune
func (*TextField) StartCursor ¶
func (tf *TextField) StartCursor()
StartCursor starts the cursor blinking and renders it
func (*TextField) StopCursor ¶
func (tf *TextField) StopCursor()
StopCursor stops the cursor from blinking
func (*TextField) StyleTextField ¶
func (tf *TextField) StyleTextField()
func (*TextField) Text ¶
Text returns the current text -- applies any unapplied changes first, and sends a signal if so -- this is the end-user method to get the current value of the field.
func (*TextField) TextFieldEvents ¶
func (tf *TextField) TextFieldEvents()
func (*TextField) TextWidth ¶
TextWidth returns the text width in dots between the two text string positions (ed is exclusive -- +1 beyond actual char)
func (*TextField) UpdateRenderAll ¶
type TextFieldSignals ¶
type TextFieldSignals int64
TextFieldSignals are signals that that textfield can send
const ( // TextFieldDone is main signal -- return or tab was pressed and the edit was // intentionally completed. data is the text. TextFieldDone TextFieldSignals = iota // TextFieldDeFocused means that the user has transitioned focus away from // the text field due to interactions elsewhere, and any ongoing changes have been // applied and the editor is no longer active. data is the text. // If you have a button that performs the same action as pressing enter in a textfield, // then pressing that button will trigger a TextFieldDeFocused event, for any active // edits. Otherwise, you probably want to respond to both TextFieldDone and // TextFieldDeFocused as "apply" events that trigger actions associated with the field. TextFieldDeFocused // TextFieldSelected means that some text was selected (for Inactive state, // selection is via WidgetSig) TextFieldSelected // TextFieldCleared means the clear button was clicked TextFieldCleared // TextFieldInsert is emitted when a character is inserted into the textfield TextFieldInsert // TextFieldBackspace is emitted when a character before cursor is deleted TextFieldBackspace // TextFieldDelete is emitted when a character after cursor is deleted TextFieldDelete TextFieldSignalsN )
func (*TextFieldSignals) FromString ¶
func (i *TextFieldSignals) FromString(s string) error
func (TextFieldSignals) String ¶
func (i TextFieldSignals) String() string
type TextFieldStates ¶
type TextFieldStates int32
TextFieldStates are mutually-exclusive textfield states -- determines appearance
const ( // normal state -- there but not being interacted with TextFieldActive TextFieldStates = iota // textfield is the focus -- will respond to keyboard input TextFieldFocus // inactive -- not editable TextFieldInactive // selected -- for inactive state, can select entire element TextFieldSel TextFieldStatesN )
func (*TextFieldStates) FromString ¶
func (i *TextFieldStates) FromString(s string) error
func (TextFieldStates) String ¶
func (i TextFieldStates) String() string
type TextLink ¶
type TextLink struct { Label string `desc:"text label for the link"` URL string `desc:"full URL for the link"` Props ki.Props `desc:"properties defined for the link"` StartSpan int `desc:"span index where link starts"` StartIdx int `desc:"index in StartSpan where link starts"` EndSpan int `desc:"span index where link ends (can be same as EndSpan)"` EndIdx int `desc:"index in EndSpan where link ends (index of last rune in label)"` Widget Node2D `desc:"the widget that owns this text link -- only set prior to passing off to handler function"` }
TextLink represents a hyperlink within rendered text
type TextLinkHandlerFunc ¶
TextLinkHandlerFunc is a function that handles TextLink links -- returns true if the link was handled, false if not (in which case it might be passed along to someone else)
var TextLinkHandler TextLinkHandlerFunc
TextLinkHandler is used to handle TextLink links, if non-nil -- set this to your own handler to get first crack at all the text link clicks -- if this function returns false (or is nil) then the URL is sent to URLHandler (the default one just calls oswin.TheApp.OpenURL)
type TextRender ¶
type TextRender struct { Spans []SpanRender Size mat32.Vec2 `desc:"last size of overall rendered text"` Dir TextDirections `desc:"where relevant, this is the (default, dominant) text direction for the span"` Links []TextLink `desc:"hyperlinks within rendered text"` }
TextRender contains one or more SpanRender elements, typically with each representing a separate line of text (but they can be anything).
func (*TextRender) InsertSpan ¶
func (tr *TextRender) InsertSpan(at int, ns *SpanRender)
InsertSpan inserts a new span at given index
func (*TextRender) LayoutStdLR ¶
func (tr *TextRender) LayoutStdLR(txtSty *TextStyle, fontSty *FontStyle, ctxt *units.Context, size mat32.Vec2) mat32.Vec2
LayoutStdLR does basic standard layout of text in LR direction, assigning relative positions to spans and runes according to given styles, and given size overall box (nonzero values used to constrain). Returns total resulting size box for text. Font face in FontStyle is used for determining line spacing here -- other versions can do more expensive calculations of variable line spacing as needed.
func (*TextRender) Render ¶
func (tr *TextRender) Render(rs *RenderState, pos mat32.Vec2)
Render does text rendering into given image, within given bounds, at given absolute position offset (specifying position of text baseline) -- any applicable transforms (aside from the char-specific rotation in Render) must be applied in advance in computing the relative positions of the runes, and the overall font size, etc. todo: does not currently support stroking, only filling of text -- probably need to grab path from font and use paint rendering for stroking
func (*TextRender) RenderTopPos ¶
func (tr *TextRender) RenderTopPos(rs *RenderState, tpos mat32.Vec2)
RenderTopPos renders at given top position -- uses first font info to compute baseline offset and calls overall Render -- convenience for simple widget rendering without layouts
func (*TextRender) RuneEndPos ¶
RuneEndPos returns the relative ending position of the given rune index, counting progressively through all spans present(adds Span RelPos and rune RelPos + rune Size.X for LR writing). If index > length, then uses LastPos. Returns also the index of the span that holds that char (-1 = no spans at all) and the rune index within that span, and false if index is out of range.
func (*TextRender) RuneRelPos ¶
RuneRelPos returns the relative (starting) position of the given rune index, counting progressively through all spans present (adds Span RelPos and rune RelPos) -- this is typically the baseline position where rendering will start, not the upper left corner. If index > length, then uses LastPos. Returns also the index of the span that holds that char (-1 = no spans at all) and the rune index within that span, and false if index is out of range.
func (*TextRender) RuneSpanPos ¶
func (tx *TextRender) RuneSpanPos(idx int) (si, ri int, ok bool)
RuneSpanPos returns the position (span, rune index within span) within a sequence of spans of a given absolute rune index, starting in the first span -- returns false if index is out of range (and returns the last position).
func (*TextRender) SetHTML ¶
func (tr *TextRender) SetHTML(str string, font *FontStyle, txtSty *TextStyle, ctxt *units.Context, cssAgg ki.Props)
SetHTML sets text by decoding all standard inline HTML text style formatting tags in the string and sets the per-character font information appropriately, using given font style info. <P> and <BR> tags create new spans, with <P> marking start of subsequent span with DecoParaStart. Critically, it does NOT deal at all with layout (positioning) except in breaking lines into different spans, but not with word wrapping -- only sets font, color, and decoration info, and strips out the tags it processes -- result can then be processed by different layout algorithms as needed. cssAgg, if non-nil, should contain CSSAgg properties -- will be tested for special css styling of each element.
func (*TextRender) SetHTMLBytes ¶
func (tr *TextRender) SetHTMLBytes(str []byte, font *FontStyle, txtSty *TextStyle, ctxt *units.Context, cssAgg ki.Props)
SetHTMLBytes does SetHTML with bytes as input -- more efficient -- use this if already in bytes
func (*TextRender) SetHTMLNoPre ¶
func (tr *TextRender) SetHTMLNoPre(str []byte, font *FontStyle, txtSty *TextStyle, ctxt *units.Context, cssAgg ki.Props)
This is the No-Pre parser that uses the golang XML decoder system, which strips all whitespace and is thus unsuitable for any Pre case
func (*TextRender) SetHTMLPre ¶
func (tr *TextRender) SetHTMLPre(str []byte, font *FontStyle, txtSty *TextStyle, ctxt *units.Context, cssAgg ki.Props)
SetHTMLPre sets preformatted HTML-styled text by decoding all standard inline HTML text style formatting tags in the string and sets the per-character font information appropriately, using given font style info. Only basic styling tags, including <span> elements with style parameters (including class names) are decoded. Whitespace is decoded as-is, including LF \n etc, except in WhiteSpacePreLine case which only preserves LF's
func (*TextRender) SetRunes ¶
func (tr *TextRender) SetRunes(str []rune, fontSty *FontStyle, ctxt *units.Context, txtSty *TextStyle, noBG bool, rot, scalex float32)
SetRunes is for basic text rendering with a single style of text (see SetHTML for tag-formatted text) -- configures a single SpanRender with the entire string, and does standard layout (LR currently). rot and scalex are general rotation and x-scaling to apply to all chars -- alternatively can apply these per character after Be sure that OpenFont has been run so a valid Face is available. noBG ignores any BgColor in font style, and never renders background color
func (*TextRender) SetString ¶
func (tr *TextRender) SetString(str string, fontSty *FontStyle, ctxt *units.Context, txtSty *TextStyle, noBG bool, rot, scalex float32)
SetString is for basic text rendering with a single style of text (see SetHTML for tag-formatted text) -- configures a single SpanRender with the entire string, and does standard layout (LR currently). rot and scalex are general rotation and x-scaling to apply to all chars -- alternatively can apply these per character after. Be sure that OpenFont has been run so a valid Face is available. noBG ignores any BgColor in font style, and never renders background color
func (*TextRender) SetStringRot90 ¶ added in v0.9.9
func (tr *TextRender) SetStringRot90(str string, fontSty *FontStyle, ctxt *units.Context, txtSty *TextStyle, noBG bool, scalex float32)
SetStringRot90 is for basic text rendering with a single style of text (see SetHTML for tag-formatted text) -- configures a single SpanRender with the entire string, and does TB rotated layout (-90 deg). Be sure that OpenFont has been run so a valid Face is available. noBG ignores any BgColor in font style, and never renders background color
func (*TextRender) SpanPosToRuneIdx ¶
func (tx *TextRender) SpanPosToRuneIdx(si, ri int) (idx int, ok bool)
SpanPosToRuneIdx returns the absolute rune index for a given span, rune index position -- i.e., the inverse of RuneSpanPos. Returns false if given input position is out of range, and returns last valid index in that case.
type TextStyle ¶
type TextStyle struct { Align Align `xml:"text-align" inherit:"true" desc:"prop: text-align = how to align text, horizontally"` AlignV Align `xml:"-" json:"-" desc:"prop: vertical-align = vertical alignment of text -- copied from layout style AlignV"` Anchor TextAnchors `` /* 204-byte string literal not displayed */ LetterSpacing units.Value `xml:"letter-spacing" desc:"prop: letter-spacing = spacing between characters and lines"` WordSpacing units.Value `xml:"word-spacing" inherit:"true" desc:"prop: word-spacing = extra space to add between words"` LineHeight float32 `` /* 296-byte string literal not displayed */ WhiteSpace WhiteSpaces `xml:"white-space" inherit:"true" desc:"prop: white-space = specifies how white space is processed, and how lines are wrapped"` UnicodeBidi UnicodeBidi `xml:"unicode-bidi" inherit:"true" desc:"prop: unicode-bidi = determines how to treat unicode bidirectional information"` Direction TextDirections `` /* 166-byte string literal not displayed */ WritingMode TextDirections `xml:"writing-mode" inherit:"true" desc:"prop: writing-mode = overall writing mode -- only for text elements, not tspan"` OrientationVert float32 `` /* 218-byte string literal not displayed */ OrientationHoriz float32 `` /* 202-byte string literal not displayed */ Indent units.Value `xml:"text-indent" inherit:"true" desc:"prop: text-indent = how much to indent the first line in a paragraph"` ParaSpacing units.Value `` /* 206-byte string literal not displayed */ TabSize int `xml:"tab-size" inherit:"true" desc:"prop: tab-size = tab size, in number of characters"` }
TextStyle is used for layout-level (widget, html-style) text styling -- FontStyle contains all the lower-level text rendering info used in SVG -- most of these are inherited
func (*TextStyle) AlignFactors ¶
AlignFactors gets basic text alignment factors
func (*TextStyle) EffLineHeight ¶
EffLineHeight returns the effective line height (taking into account 0 value)
func (*TextStyle) HasPre ¶
HasPre returns true if current white space option preserves existing whitespace (or at least requires that parser in case of PreLine, which is intermediate)
func (*TextStyle) HasWordWrap ¶
HasWordWrap returns true if current white space option supports word wrap
func (*TextStyle) InheritFields ¶
InheritFields from parent: Manual inheriting of values is much faster than automatic version!
func (*TextStyle) SetStylePost ¶
SetStylePost applies any updates after generic xml-tag property setting
type ToolBar ¶
type ToolBar struct {
Layout
}
ToolBar is a Layout (typically LayoutHoriz) that renders a gradient background and is useful for holding Actions that do things
func AddNewToolBar ¶ added in v0.9.7
AddNewToolBar adds a new toolbar to given parent node, with given name.
func (*ToolBar) AddAction ¶
AddAction adds an action to the toolbar using given options, and connects the action signal to given receiver object and function, along with given data which is stored on the action and then passed in the action signal. Optional updateFunc is a function called prior to showing the menu to update the actions (enabled or not typically).
func (*ToolBar) AddSeparator ¶ added in v0.9.7
AddSeparator adds a new separator to the toolbar -- automatically sets orientation depending on layout. All nodes need a name identifier.
func (*ToolBar) ConnectEvents2D ¶
func (tb *ToolBar) ConnectEvents2D()
func (*ToolBar) CopyFieldsFrom ¶ added in v0.9.8
func (tb *ToolBar) CopyFieldsFrom(frm interface{})
func (*ToolBar) DeleteShortcuts ¶ added in v0.9.14
func (tb *ToolBar) DeleteShortcuts()
DeleteShortcuts deletes the shortcuts -- called when destroyed
func (*ToolBar) FindActionByName ¶
FindActionByName finds an action on the toolbar, or any sub-menu, with given name (exact match) -- this is not the Text label but the Name of the element (for AddAction items, this is the same as Label or Icon (if Label is empty)) -- returns false if not found
func (*ToolBar) MouseFocusEvent ¶
func (tb *ToolBar) MouseFocusEvent()
func (*ToolBar) SetShortcuts ¶ added in v0.9.14
func (tb *ToolBar) SetShortcuts()
SetShortcuts sets the shortcuts to window associated with Toolbar Called in ConnectEvents2D()
func (*ToolBar) ToolBarStdRender ¶
func (tb *ToolBar) ToolBarStdRender()
ToolBarStdRender does the standard rendering of the bar
func (*ToolBar) UpdateActions ¶
func (tb *ToolBar) UpdateActions()
UpdateActions calls UpdateFunc on all actions in toolbar -- individual menus are automatically updated just prior to menu popup
type Transform3D ¶
type Transform3D struct { Transform mgl32.Mat4 // overall compiled transform Scale mgl32.Vec3 Translation mgl32.Vec3 Orientation mgl32.Quat }
3D transform
type URLHandlerFunc ¶
URLHandlerFunc is a function that handles URL links -- returns true if the link was handled, false if not (in which case it might be passed along to someone else).
type UnicodeBidi ¶
type UnicodeBidi int32
https://godoc.org/golang.org/x/text/unicode/bidi UnicodeBidi determines how
const ( BidiNormal UnicodeBidi = iota BidiEmbed BidiBidiOverride UnicodeBidiN )
func (*UnicodeBidi) FromString ¶
func (i *UnicodeBidi) FromString(s string) error
func (UnicodeBidi) MarshalJSON ¶
func (ev UnicodeBidi) MarshalJSON() ([]byte, error)
func (UnicodeBidi) String ¶
func (i UnicodeBidi) String() string
func (*UnicodeBidi) UnmarshalJSON ¶
func (ev *UnicodeBidi) UnmarshalJSON(b []byte) error
type Updater ¶ added in v0.9.8
type Updater interface { // Update updates anything in this type that might depend on other state // which could have just been changed. It is the responsibility of the // type to determine what might have changed, or just generically update // everything assuming anything could have changed. Update() }
Updater defines an interface for something that has an Update() method this will be called by GUI actions that update values of a type including struct, slice, and map views in giv
type User ¶
type User struct { user.User Email string `desc:"default email address -- e.g., for recording changes in a version control system"` }
User basic user information that might be needed for different apps
type VectorEffects ¶ added in v0.9.8
type VectorEffects int32
VectorEffects contains special effects for rendering
const ( VecEffNone VectorEffects = iota // VecEffNonScalingStroke means that the stroke width is not affected by // transform properties VecEffNonScalingStroke VecEffN )
func (*VectorEffects) FromString ¶ added in v0.9.8
func (i *VectorEffects) FromString(s string) error
func (VectorEffects) MarshalJSON ¶ added in v0.9.8
func (ev VectorEffects) MarshalJSON() ([]byte, error)
func (VectorEffects) String ¶ added in v0.9.8
func (i VectorEffects) String() string
func (*VectorEffects) UnmarshalJSON ¶ added in v0.9.8
func (ev *VectorEffects) UnmarshalJSON(b []byte) error
type ViewIFace ¶
type ViewIFace interface { // CtxtMenuView configures a popup context menu according to the // "CtxtMenu" properties registered on the type for given value element, // through the kit.AddType method. See // https://github.com/goki/gi/wiki/Views for full details on formats and // options for configuring the menu. It looks first for "CtxtMenuActive" // or "CtxtMenuInactive" depending on inactive flag (which applies to the // gui view), so you can have different menus in those cases, and then // falls back on "CtxtMenu". Returns false if there is no context menu // defined for this type, or on errors (which are programmer errors sent // to log). CtxtMenuView(val interface{}, inactive bool, vp *Viewport2D, menu *Menu) bool // GoGiEditor opens an interactive editor of given Ki tree, at its root GoGiEditor(obj ki.Ki) // PrefsView opens an interactive view of given preferences object PrefsView(prefs *Preferences) // KeyMapsView opens an interactive view of KeyMaps object KeyMapsView(maps *KeyMaps) // PrefsDetView opens an interactive view of given detailed preferences object PrefsDetView(prefs *PrefsDetailed) // HiStylesView opens an interactive view of custom or std highlighting styles. HiStylesView(std bool) // SetHiStyleDefault sets the current default histyle.StyleDefault SetHiStyleDefault(hsty HiStyleName) // HiStyleInit initializes the histyle package -- called during overall gi init. HiStyleInit() // PrefsDetDefaults gets current detailed prefs values as defaults PrefsDetDefaults(prefs *PrefsDetailed) // PrefsDetApply applies detailed preferences within giv scope PrefsDetApply(prefs *PrefsDetailed) // PrefsDbgView opens an interactive view of given debugging preferences object PrefsDbgView(prefs *PrefsDebug) }
ViewIFace is an interface into the View GUI types in giv subpackage, allowing it to be a sub-package with just this narrow set of dependencies of gi on giv. The one impl is in giv/valueview.go.
var TheViewIFace ViewIFace
TheViewIFace is the implementation of the interface, defined in giv package
type Viewport ¶ added in v0.9.11
type Viewport interface { // VpTop returns the top-level Viewport, which could be this one // or a higher one. VpTopNode and VpEventMgr should be called on // on the Viewport returned by this method. For popups // this *not* the popup viewport but rather the window top viewport. VpTop() Viewport // VpTopNode returns the top node for this viewport. // must be called on VpTop() VpTopNode() Node // VpTopUpdateStart calls UpdateStart on VpTopNode2D(). Use this // for TopUpdateStart / End around multiple dispersed updates to // properly batch everything and prevent redundant updates. VpTopUpdateStart() bool // VpTopUpdateEnd calls UpdateEnd on VpTopNode2D(). Use this // for TopUpdateStart / End around multiple dispersed updates to // properly batch everything and prevent redundant updates. VpTopUpdateEnd(updt bool) // VpEventMgr returns the event manager for this viewport. // Must be called on VpTop(). Can be nil. VpEventMgr() *EventMgr // VpIsVisible returns true if this viewport is visible. // If false, rendering is aborted VpIsVisible() bool // VpUploadAll is the update call for the main viewport for a window -- // calls UploadAllViewports in parent window, which uploads the main viewport // and any active popups etc over the top of that VpUploadAll() // VpUploadVp uploads our viewport image into the parent window -- e.g., called // by popups when updating separately VpUploadVp() // VpUploadRegion uploads node region of our viewport image VpUploadRegion(vpBBox, winBBox image.Rectangle) }
Viewport provides an interface for viewports, supporting overall management functions that can be provided by more embedded viewports for example.
type Viewport2D ¶
type Viewport2D struct { WidgetBase Fill bool `desc:"fill the viewport with background-color from style"` Geom Geom2DInt `desc:"Viewport-level viewbox within any parent Viewport2D"` Render RenderState `copy:"-" json:"-" xml:"-" view:"-" desc:"render state for rendering"` Pixels *image.RGBA `copy:"-" json:"-" xml:"-" view:"-" desc:"live pixels that we render into"` Win *Window `copy:"-" json:"-" xml:"-" desc:"our parent window that we render into"` CurStyleNode Node2D `` /* 178-byte string literal not displayed */ CurColor Color `` /* 224-byte string literal not displayed */ UpdtMu sync.Mutex `copy:"-" json:"-" xml:"-" view:"-" desc:"UpdtMu is mutex for viewport updates"` UpdtStack []Node2D `copy:"-" json:"-" xml:"-" view:"-" desc:"stack of nodes requring basic updating"` ReStack []Node2D `copy:"-" json:"-" xml:"-" view:"-" desc:"stack of nodes requiring a ReRender (i.e., anchors)"` StackMu sync.Mutex `copy:"-" json:"-" xml:"-" view:"-" desc:"StackMu is mutex for adding to UpdtStack"` StyleMu sync.RWMutex `copy:"-" json:"-" xml:"-" view:"-" desc:"StyleMu is RW mutex protecting access to Style-related global vars"` }
Viewport2D provides an image and a stack of Paint contexts for drawing onto the image with a convenience forwarding of the Paint methods operating on the current Paint
func NewViewport2D ¶
func NewViewport2D(width, height int) *Viewport2D
NewViewport2D creates a new Pixels Image with the specified width and height, and initializes the renderer etc
func PopupMenu ¶
func PopupMenu(menu Menu, x, y int, parVp *Viewport2D, name string) *Viewport2D
PopupMenu pops up a viewport with a layout that draws the supplied actions positions are relative to given viewport -- name is relevant base name to which Menu is appended
func PopupTooltip ¶
func PopupTooltip(tooltip string, x, y int, parVp *Viewport2D, name string) *Viewport2D
PopupTooltip pops up a viewport displaying the tooltip text
func StringsChooserPopup ¶
StringsChooserPopup creates a menu of the strings in the given string slice, and calls the given function on receiver when the user selects -- this is the ActionSig signal, coming from the Action for the given menu item -- the name of the Action is the string value, and the data will be the index in the slice. A string equal to curSel will be marked as selected. Location is from the ContextMenuPos of recv node.
func ValidViewport ¶
func ValidViewport(avp *Viewport2D) *Viewport2D
ValidViewport finds a non-nil viewport, either using the provided one, or using the first main window's viewport
func (*Viewport2D) AsViewport2D ¶
func (vp *Viewport2D) AsViewport2D() *Viewport2D
func (*Viewport2D) BBox2D ¶
func (vp *Viewport2D) BBox2D() image.Rectangle
func (*Viewport2D) BlockUpdates ¶ added in v0.9.8
func (vp *Viewport2D) BlockUpdates()
BlockUpdates uses the UpdtMu lock to block all updates to this viewport. This is *ONLY* needed when structural updates to the scenegraph are being made from a different goroutine outside of the one this window's event loop is running on. This prevents an update from happening in the middle of the construction process and thus attempting to render garbage. Must call UnblockUpdates after construction is done.
func (*Viewport2D) ChildrenBBox2D ¶
func (vp *Viewport2D) ChildrenBBox2D() image.Rectangle
func (*Viewport2D) ComputeBBox2D ¶
func (vp *Viewport2D) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)
func (*Viewport2D) CopyFieldsFrom ¶ added in v0.9.8
func (vp *Viewport2D) CopyFieldsFrom(frm interface{})
func (*Viewport2D) CurStyleNodeNamedEl ¶
func (vp *Viewport2D) CurStyleNodeNamedEl(name string) Node2D
CurStyleNodeNamedEl finds element of given name (using FindNamedElement method) in current style node, if set -- returns nil if not set or not found.
func (*Viewport2D) CurrentColor ¶
func (vp *Viewport2D) CurrentColor() Color
CurrentColor gets the current color in concurrent-safe way
func (*Viewport2D) DeletePopup ¶
func (vp *Viewport2D) DeletePopup()
Delete this popup viewport -- has already been disconnected from window events and parent is nil -- called by window when a popup is deleted -- it destroys the vp and its main layout, see VpFlagPopupDestroyAll for whether children are destroyed
func (*Viewport2D) DrawIntoParent ¶
func (vp *Viewport2D) DrawIntoParent(parVp *Viewport2D)
DrawIntoParent draws our viewport image into parent's image -- this is the typical way that a sub-viewport renders (e.g., svg boxes, icons, etc -- not popups)
func (*Viewport2D) EncodePNG ¶
func (vp *Viewport2D) EncodePNG(w io.Writer) error
EncodePNG encodes the image as a PNG and writes it to the provided io.Writer.
func (*Viewport2D) FillViewport ¶
func (vp *Viewport2D) FillViewport()
func (*Viewport2D) FullReRenderIfNeeded ¶ added in v0.9.11
func (vp *Viewport2D) FullReRenderIfNeeded() bool
func (*Viewport2D) FullRender2DTree ¶
func (vp *Viewport2D) FullRender2DTree()
FullRender2DTree is called by window and other places to completely re-render -- we set our flag when doing this so valueview elements (and anyone else) can do a deep re-build that is typically not otherwise needed (e.g., after non-signaling structs have updated)
func (*Viewport2D) Init2D ¶
func (vp *Viewport2D) Init2D()
func (*Viewport2D) IsCompleter ¶
func (vp *Viewport2D) IsCompleter() bool
func (*Viewport2D) IsCorrector ¶
func (vp *Viewport2D) IsCorrector() bool
func (*Viewport2D) IsDoingFullRender ¶
func (vp *Viewport2D) IsDoingFullRender() bool
func (*Viewport2D) IsMenu ¶
func (vp *Viewport2D) IsMenu() bool
func (*Viewport2D) IsPopup ¶
func (vp *Viewport2D) IsPopup() bool
func (*Viewport2D) IsSVG ¶
func (vp *Viewport2D) IsSVG() bool
func (*Viewport2D) IsTooltip ¶
func (vp *Viewport2D) IsTooltip() bool
func (*Viewport2D) IsUpdatingNode ¶ added in v0.9.8
func (vp *Viewport2D) IsUpdatingNode() bool
func (*Viewport2D) IsVisible ¶
func (vp *Viewport2D) IsVisible() bool
func (*Viewport2D) Layout2D ¶
func (vp *Viewport2D) Layout2D(parBBox image.Rectangle, iter int) bool
func (*Viewport2D) Move2D ¶
func (vp *Viewport2D) Move2D(delta image.Point, parBBox image.Rectangle)
func (*Viewport2D) NeedsFullRender ¶ added in v0.9.8
func (vp *Viewport2D) NeedsFullRender() bool
func (*Viewport2D) NodeUpdated ¶ added in v0.9.8
func (vp *Viewport2D) NodeUpdated(nii Node2D, sig int64, data interface{})
NodeUpdated is called from SignalViewport2D when a valid node's NodeSig sent a signal usually after UpdateEnd.
func (*Viewport2D) PopBounds ¶
func (vp *Viewport2D) PopBounds()
func (*Viewport2D) PrefSize ¶ added in v0.9.15
func (vp *Viewport2D) PrefSize(initSz image.Point) image.Point
PrefSize computes the preferred size of the viewport based on current contents. initSz is the initial size -- e.g., size of screen. Used for auto-sizing windows.
func (*Viewport2D) PushBounds ¶
func (vp *Viewport2D) PushBounds() bool
we use our own render for these -- Viewport member is our parent!
func (*Viewport2D) ReRender2DAnchor ¶
func (vp *Viewport2D) ReRender2DAnchor(gni Node2D)
ReRender2DAnchor re-renders an anchor node -- the KEY diff from ReRender2DNode is that it calls ReRender2DTree and not just Render2DTree! uploads updated bits to the window texture using Window.UploadVpRegion call. This should be covered by an outer UpdateStart / End bracket on Window to drive publishing changes, with suitable grouping if multiple updates
func (*Viewport2D) ReRender2DNode ¶
func (vp *Viewport2D) ReRender2DNode(gni Node2D)
ReRender2DNode re-renders a specific node, including uploading updated bits to the window texture using Window.UploadVpRegion call. This should be covered by an outer UpdateStart / End bracket on Window to drive publishing changes, with suitable grouping if multiple updates
func (*Viewport2D) Render2D ¶
func (vp *Viewport2D) Render2D()
func (*Viewport2D) RenderViewport2D ¶
func (vp *Viewport2D) RenderViewport2D()
RenderViewport2D is the render action for the viewport itself -- either uploads image to window or draws into parent viewport
func (*Viewport2D) Resize ¶
func (vp *Viewport2D) Resize(nwsz image.Point)
Resize resizes the viewport, creating a new image -- updates Geom Size
func (*Viewport2D) SavePNG ¶
func (vp *Viewport2D) SavePNG(path string) error
SavePNG encodes the image as a PNG and writes it to disk.
func (*Viewport2D) SetCurStyleNode ¶
func (vp *Viewport2D) SetCurStyleNode(node Node2D)
SetCurStyleNode sets the current styling node to given node, and nil to clear
func (*Viewport2D) SetCurWin ¶
func (vp *Viewport2D) SetCurWin()
set our window pointer to point to the current window we are under
func (*Viewport2D) SetCurrentColor ¶
func (vp *Viewport2D) SetCurrentColor(clr Color)
SetCurrentColor sets the current color in concurrent-safe way
func (*Viewport2D) SetNeedsFullRender ¶ added in v0.9.8
func (vp *Viewport2D) SetNeedsFullRender()
SetNeedsFullRender sets the flag indicating that a full render of the viewport is needed it will do this immediately pending acquisition of the lock and through the standard updating channels, unless already updating.
func (*Viewport2D) Size2D ¶
func (vp *Viewport2D) Size2D(iter int)
func (*Viewport2D) Style2D ¶
func (vp *Viewport2D) Style2D()
func (*Viewport2D) UnblockUpdates ¶ added in v0.9.8
func (vp *Viewport2D) UnblockUpdates()
UnblockUpdates unblocks updating of this viewport -- see BlockUpdates()
func (*Viewport2D) UpdateLevel ¶ added in v0.9.8
func (vp *Viewport2D) UpdateLevel(nii Node2D, sig int64, data interface{}) (anchor Node2D, full bool)
UpdateLevel deteremines what level of updating a node requires
func (*Viewport2D) UpdateNode ¶ added in v0.9.8
func (vp *Viewport2D) UpdateNode(nii Node2D)
UpdateNode is called under UpdtMu lock and does the actual steps to update a given node
func (*Viewport2D) UpdateNodes ¶ added in v0.9.8
func (vp *Viewport2D) UpdateNodes()
UpdateNodes processes the current update signals and actually does the relevant updating
func (*Viewport2D) VpEventMgr ¶ added in v0.9.11
func (vp *Viewport2D) VpEventMgr() *EventMgr
func (*Viewport2D) VpIsVisible ¶ added in v0.9.11
func (vp *Viewport2D) VpIsVisible() bool
func (*Viewport2D) VpTop ¶ added in v0.9.11
func (vp *Viewport2D) VpTop() Viewport
func (*Viewport2D) VpTopNode ¶ added in v0.9.11
func (vp *Viewport2D) VpTopNode() Node
func (*Viewport2D) VpTopUpdateEnd ¶ added in v0.9.11
func (vp *Viewport2D) VpTopUpdateEnd(updt bool)
func (*Viewport2D) VpTopUpdateStart ¶ added in v0.9.11
func (vp *Viewport2D) VpTopUpdateStart() bool
func (*Viewport2D) VpUploadAll ¶ added in v0.9.11
func (vp *Viewport2D) VpUploadAll()
VpUploadAll is the update call for the main viewport for a window -- calls UploadAllViewports in parent window, which uploads the main viewport and any active popups etc over the top of that
func (*Viewport2D) VpUploadRegion ¶ added in v0.9.11
func (vp *Viewport2D) VpUploadRegion(vpBBox, winBBox image.Rectangle)
VpUploadRegion uploads node region of our viewport image
func (*Viewport2D) VpUploadVp ¶ added in v0.9.11
func (vp *Viewport2D) VpUploadVp()
VpUploadVp uploads our viewport image into the parent window -- e.g., called by popups when updating separately
type VpFlags ¶ added in v0.9.9
type VpFlags int
VpFlags extend NodeBase NodeFlags to hold viewport state
const ( // VpFlagPopup means viewport is a popup (menu or dialog) -- does not obey // parent bounds (otherwise does) VpFlagPopup VpFlags = VpFlags(NodeFlagsN) + iota // VpFlagMenu means viewport is serving as a popup menu -- affects how window // processes clicks VpFlagMenu // VpFlagCompleter means viewport is serving as a popup menu for code completion -- // only applies if the VpFlagMenu is also set VpFlagCompleter // VpFlagCorrector means viewport is serving as a popup menu for spelling correction -- // only applies if the VpFlagMenu is also set VpFlagCorrector // VpFlagTooltip means viewport is serving as a tooltip VpFlagTooltip // VpFlagPopupDestroyAll means that if this is a popup, then destroy all // the children when it is deleted -- otherwise children below the main // layout under the vp will not be destroyed -- it is up to the caller to // manage those (typically these are reusable assets) VpFlagPopupDestroyAll // VpFlagSVG means that this viewport is an SVG viewport -- SVG elements // look for this for re-rendering VpFlagSVG // VpFlagUpdatingNode means that this viewport is currently handling the // update of a node, and is under the UpdtMu mutex lock. // This can be checked to see about whether to add another update or not. VpFlagUpdatingNode // VpFlagNeedsFullRender means that this viewport needs to do a full // render -- this is set during signal processing and will preempt // other lower-level updates etc. VpFlagNeedsFullRender // VpFlagDoingFullRender means that this viewport is currently doing a // full render -- can be used by elements to drive deep rebuild in case // underlying data has changed. VpFlagDoingFullRender // VpFlagPrefSizing means that this viewport is currently doing a // PrefSize computation to compute the size of the viewport // (for sizing window for example) -- affects layout size computation // only for Over VpFlagPrefSizing VpFlagsN )
func StringToVpFlags ¶ added in v0.9.9
type WhiteSpaces ¶
type WhiteSpaces int32
WhiteSpaces determine how white space is processed
const ( // WhiteSpaceNormal means that all white space is collapsed to a single // space, and text wraps when necessary WhiteSpaceNormal WhiteSpaces = iota // WhiteSpaceNowrap means that sequences of whitespace will collapse into // a single whitespace. Text will never wrap to the next line. The text // continues on the same line until a <br> tag is encountered WhiteSpaceNowrap // WhiteSpacePre means that whitespace is preserved by the browser. Text // will only wrap on line breaks. Acts like the <pre> tag in HTML. This // invokes a different hand-written parser because the default golang // parser automatically throws away whitespace WhiteSpacePre // WhiteSpacePreLine means that sequences of whitespace will collapse // into a single whitespace. Text will wrap when necessary, and on line // breaks WhiteSpacePreLine // WhiteSpacePreWrap means that whitespace is preserved by the // browser. Text will wrap when necessary, and on line breaks WhiteSpacePreWrap WhiteSpacesN )
func (*WhiteSpaces) FromString ¶
func (i *WhiteSpaces) FromString(s string) error
func (WhiteSpaces) MarshalJSON ¶
func (ev WhiteSpaces) MarshalJSON() ([]byte, error)
func (WhiteSpaces) String ¶
func (i WhiteSpaces) String() string
func (*WhiteSpaces) UnmarshalJSON ¶
func (ev *WhiteSpaces) UnmarshalJSON(b []byte) error
type WidgetBase ¶
type WidgetBase struct { Node2DBase Tooltip string `desc:"text for tooltip for this widget -- can use HTML formatting"` Sty Style `` /* 139-byte string literal not displayed */ DefStyle *Style `` /* 216-byte string literal not displayed */ LayState LayoutState `copy:"-" json:"-" xml:"-" desc:"all the layout state information for this item"` WidgetSig ki.Signal `` /* 215-byte string literal not displayed */ CtxtMenuFunc CtxtMenuFunc `` /* 233-byte string literal not displayed */ }
WidgetBase is the base type for all Widget Node2D elements, which are managed by a containing Layout, and use all 5 rendering passes. All elemental widgets must support the Node Inactive and Selected states in a reasonable way (Selected only essential when also Inactive), so they can function appropriately in a chooser (e.g., SliceView or TableView) -- this includes toggling selection on left mouse press.
func (*WidgetBase) AddParentPos ¶
func (wb *WidgetBase) AddParentPos() mat32.Vec2
AddParentPos adds the position of our parent to our layout position -- layout computations are all relative to parent position, so they are finally cached out at this stage also returns the size of the parent for setting units context relative to parent objects
func (*WidgetBase) AsWidget ¶
func (wb *WidgetBase) AsWidget() *WidgetBase
func (*WidgetBase) BBox2D ¶
func (wb *WidgetBase) BBox2D() image.Rectangle
func (*WidgetBase) BBoxFromAlloc ¶
func (wb *WidgetBase) BBoxFromAlloc() image.Rectangle
BBoxFromAlloc gets our bbox from Layout allocation.
func (*WidgetBase) ChildrenBBox2D ¶
func (wb *WidgetBase) ChildrenBBox2D() image.Rectangle
func (*WidgetBase) ChildrenBBox2DWidget ¶
func (wb *WidgetBase) ChildrenBBox2DWidget() image.Rectangle
ChildrenBBox2DWidget provides a basic widget box-model subtraction of margin and padding to children -- call in ChildrenBBox2D for most widgets
func (*WidgetBase) ComputeBBox2D ¶
func (wb *WidgetBase) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)
func (*WidgetBase) CopyFieldsFrom ¶ added in v0.9.8
func (wb *WidgetBase) CopyFieldsFrom(frm interface{})
func (*WidgetBase) DefaultStyle2DWidget ¶
func (wb *WidgetBase) DefaultStyle2DWidget(selector string, part *WidgetBase) *Style
DefaultStyle2DWidget retrieves default style object for the type, from type properties -- selector is optional selector for state etc. Property key is "__DefStyle" + selector -- if part != nil, then use that obj for getting the default style starting point when creating a new style. Also stores a "__DefProps"+selector type property of the props used for styling here, for accessing properties that are not compiled into standard Style object.
func (*WidgetBase) Disconnect ¶ added in v0.9.8
func (wb *WidgetBase) Disconnect()
func (*WidgetBase) EmitContextMenuSignal ¶
func (wb *WidgetBase) EmitContextMenuSignal()
EmitContextMenuSignal emits the WidgetContextMenu signal for this widget
func (*WidgetBase) EmitFocusedSignal ¶
func (wb *WidgetBase) EmitFocusedSignal()
EmitFocusedSignal emits the WidgetFocused signal for this widget
func (*WidgetBase) EmitSelectedSignal ¶
func (wb *WidgetBase) EmitSelectedSignal()
EmitSelectedSignal emits the WidgetSelected signal for this widget
func (*WidgetBase) FullReRenderIfNeeded ¶
func (wb *WidgetBase) FullReRenderIfNeeded() bool
FullReRenderIfNeeded tests if the FullReRender flag has been set, and if so, calls ReRender2DTree and returns true -- call this at start of each Render2D
func (*WidgetBase) HoverTooltipEvent ¶
func (wb *WidgetBase) HoverTooltipEvent()
HoverTooltipEvent connects to HoverEvent and pops up a tooltip -- most widgets should call this as part of their event connection method
func (*WidgetBase) Init2D ¶
func (wb *WidgetBase) Init2D()
func (*WidgetBase) Init2DWidget ¶
func (wb *WidgetBase) Init2DWidget()
Init2DWidget handles basic node initialization -- Init2D can then do special things
func (*WidgetBase) InitLayout2D ¶
func (wb *WidgetBase) InitLayout2D() bool
func (*WidgetBase) Layout2D ¶
func (wb *WidgetBase) Layout2D(parBBox image.Rectangle, iter int) bool
func (*WidgetBase) Layout2DBase ¶
func (wb *WidgetBase) Layout2DBase(parBBox image.Rectangle, initStyle bool, iter int)
Layout2DBase provides basic Layout2D functions -- good for most cases
func (*WidgetBase) MakeContextMenu ¶
func (wb *WidgetBase) MakeContextMenu(m *Menu)
func (*WidgetBase) Move2D ¶
func (wb *WidgetBase) Move2D(delta image.Point, parBBox image.Rectangle)
func (*WidgetBase) Move2DBase ¶
func (wb *WidgetBase) Move2DBase(delta image.Point, parBBox image.Rectangle)
Move2DBase does the basic move on this node
func (*WidgetBase) Move2DTree ¶
func (wb *WidgetBase) Move2DTree()
Move2DTree does move2d pass -- each node iterates over children for maximum control -- this starts with parent ChildrenBBox and current delta -- can be called de novo
func (*WidgetBase) ParentLayout ¶
func (wb *WidgetBase) ParentLayout() *Layout
ParentLayout returns the parent layout
func (*WidgetBase) PopBounds ¶
func (wb *WidgetBase) PopBounds()
PopBounds pops our bounding-box bounds -- last step in Render2D after rendering children
func (*WidgetBase) PushBounds ¶
func (wb *WidgetBase) PushBounds() bool
PushBounds pushes our bounding-box bounds onto the bounds stack if non-empty -- this limits our drawing to our own bounding box, automatically -- must be called as first step in Render2D returns whether the new bounds are empty or not -- if empty then don't render!
func (*WidgetBase) ReRender2DTree ¶
func (wb *WidgetBase) ReRender2DTree()
ReRender2DTree does a re-render of the tree -- after it has already been initialized and styled -- redoes the full stack
func (*WidgetBase) Render2D ¶
func (wb *WidgetBase) Render2D()
func (*WidgetBase) RenderBoxImpl ¶
RenderBoxImpl implements the standard box model rendering -- assumes all paint params have already been set
func (*WidgetBase) RenderStdBox ¶
func (wb *WidgetBase) RenderStdBox(st *Style)
RenderStdBox draws standard box using given style
func (*WidgetBase) Size2D ¶
func (wb *WidgetBase) Size2D(iter int)
func (*WidgetBase) Size2DAddSpace ¶
func (wb *WidgetBase) Size2DAddSpace()
Size2DAddSpace adds space to existing AllocSize
func (*WidgetBase) Size2DBase ¶
func (wb *WidgetBase) Size2DBase(iter int)
func (*WidgetBase) Size2DFromWH ¶
func (wb *WidgetBase) Size2DFromWH(w, h float32)
set our LayState.Alloc.Size from constraints
func (*WidgetBase) Size2DSubSpace ¶
func (wb *WidgetBase) Size2DSubSpace() mat32.Vec2
Size2DSubSpace returns AllocSize minus 2 * BoxSpace -- the amount avail to the internal elements
func (*WidgetBase) Style ¶
func (wb *WidgetBase) Style() *Style
Style satisfies the Styler interface
func (*WidgetBase) Style2D ¶
func (wb *WidgetBase) Style2D()
func (*WidgetBase) Style2DWidget ¶
func (wb *WidgetBase) Style2DWidget()
Style2DWidget styles the Style values from node properties and optional base-level defaults -- for Widget-style nodes
func (*WidgetBase) StylePart ¶
func (wb *WidgetBase) StylePart(pk Node2D)
StylePart sets the style properties for a child in parts (or any other child) based on its name -- only call this when new parts were created -- name of properties is #partname (lower cased) and it should contain a ki.Props which is then added to the part's props -- this provides built-in defaults for parts, so it is separate from the CSS process
func (*WidgetBase) WidgetMouseEvents ¶
func (wb *WidgetBase) WidgetMouseEvents(sel, ctxtMenu bool)
WidgetMouseEvents connects to either or both mouse events -- IMPORTANT: if you need to also connect to other mouse events, you must copy this code -- all processing of a mouse event must happen within one function b/c there can only be one registered per receiver and event type. sel = Left button mouse.Press event, toggles the selected state, and emits a SelectedEvent. ctxtMenu = connects to Right button mouse.Press event, and sends a WidgetSig WidgetContextMenu signal, followed by calling ContextMenu method -- signal can be used to change state prior to generating context menu, including setting a CtxtMenuFunc that removes all items and thus negates the presentation of any menu
type WidgetSignals ¶
type WidgetSignals int64
WidgetSignals are general signals that all widgets can send, via WidgetSig signal
const ( // WidgetSelected is triggered when a widget is selected, typically via // left mouse button click (see EmitSelectedSignal) -- is NOT contingent // on actual IsSelected status -- just reports the click event WidgetSelected WidgetSignals = iota // WidgetFocused is triggered when a widget receives keyboard focus (see // EmitFocusedSignal -- call in FocusChanged2D for gotFocus WidgetFocused // WidgetContextMenu is triggered when a widget receives a // right-mouse-button press, BEFORE generating and displaying the context // menu, so that relevant state can be updated etc (see // EmitContextMenuSignal) WidgetContextMenu WidgetSignalsN )
func (*WidgetSignals) FromString ¶
func (i *WidgetSignals) FromString(s string) error
func (WidgetSignals) String ¶
func (i WidgetSignals) String() string
type WinEventRecv ¶
WinEventRecv is used to hold info about widgets receiving event signals to given function, used for sorting and delayed sending.
type WinFlags ¶ added in v0.9.9
type WinFlags int
WinFlags extend NodeBase NodeFlags to hold Window state
const ( // WinFlagHasGeomPrefs indicates if this window has WinGeomPrefs setting that // sized it -- affects whether other default geom should be applied. WinFlagHasGeomPrefs WinFlags = WinFlags(NodeFlagsN) + iota // WinFlagUpdating is atomic flag around global updating -- routines can check IsWinUpdating and bail WinFlagUpdating // WinFlagIsClosing is atomic flag indicating window is closing WinFlagIsClosing // WinFlagIsResizing is atomic flag indicating window is resizing WinFlagIsResizing // WinFlagOverTexActive is the overlay texture active and should be uploaded to window? WinFlagOverTexActive // WinFlagGotPaint have we received our first paint event yet? // ignore other window events before this point WinFlagGotPaint // WinFlagGotFocus indicates that have we received OSWin focus WinFlagGotFocus // WinFlagSentShow have we sent the show event yet? Only ever sent ONCE WinFlagSentShow // WinFlagGoLoop true if we are running from GoStartEventLoop -- requires a WinWait.Done at end WinFlagGoLoop // WinFlagStopEventLoop is set when event loop stop is requested WinFlagStopEventLoop // WinFlagDoFullRender is set at event loop startup to trigger a full render once the window // is properly shown WinFlagDoFullRender // WinFlagPublishFullReRender triggers a complete update of window textures // during final publish WinFlagPublishFullReRender // WinFlagFocusActive indicates if widget focus is currently in an active state or not WinFlagFocusActive WinFlagsN )
func StringToWinFlags ¶ added in v0.9.9
type Window ¶
type Window struct { NodeBase Title string `` /* 143-byte string literal not displayed */ Data interface{} `` /* 188-byte string literal not displayed */ OSWin oswin.Window `` /* 135-byte string literal not displayed */ EventMgr EventMgr `json:"-" xml:"-" desc:"event manager that handles dispersing events to nodes"` Viewport *Viewport2D `json:"-" xml:"-" desc:"convenience pointer to window's master viewport child that handles the rendering"` MasterVLay *Layout `` /* 126-byte string literal not displayed */ MainMenu *MenuBar `` /* 144-byte string literal not displayed */ OverTex oswin.Texture `json:"-" xml:"-" view:"-" desc:"overlay texture that is updated from Sprites"` Sprites Sprites `json:"-" xml:"-" desc:"sprites are named images that are rendered into the overtex."` ActiveSprites int `` /* 136-byte string literal not displayed */ DirectUps map[Node2D]Node2D `json:"-" xml:"-" view:"-" desc:"list of objects that do direct upload rendering to window (e.g., gi3d.Scene)"` UpMu sync.Mutex `json:"-" xml:"-" view:"-" desc:"mutex that protects all updating / uploading of Textures"` Shortcuts Shortcuts `` /* 165-byte string literal not displayed */ Popup ki.Ki `json:"-" xml:"-" desc:"Current popup viewport that gets all events"` PopupStack []ki.Ki `json:"-" xml:"-" desc:"stack of popups"` NextPopup ki.Ki `json:"-" xml:"-" desc:"this popup will be pushed at the end of the current event cycle -- use SetNextPopup"` PopupFocus ki.Ki `json:"-" xml:"-" desc:"node to focus on when next popup is activated -- use SetNextPopup"` DelPopup ki.Ki `json:"-" xml:"-" desc:"this popup will be popped at the end of the current event cycle -- use SetDelPopup"` PopMu sync.RWMutex `json:"-" xml:"-" view:"-" desc:"read-write mutex that protects popup updating and access"` // contains filtered or unexported fields }
Window provides an OS-specific window and all the associated event handling. Widgets connect to event signals to receive relevant GUI events. There is a master Viewport that contains the full bitmap image of the window, onto which most widgets render. For main windows (not dialogs or other popups), there is a master vertical layout under the Viewport (MasterVLay), whose first element is the MainMenu for the window (which can be empty, in which case it is not displayed). On MacOS, this main menu updates the overall menubar, and also can show the local menu (on by default).
Widgets should always use methods to access / set state, and generally should not do much directly with the window. Almost everything here needs to be guarded by various mutexes. Leaving everything accessible so expert outside access is still possible in a pinch, but again don't use it unless you know what you're doing (and it might change over time too..)
Rendering logic:
- oswin.Texture is a GPU Texture that can be uploaded very quickly to window or to another texture. Viewport2D has image.RGBA Pixels that 2D draws onto, and this can be efficiently uploaded to Texture. (at some point, could consider GPU accelerated rendering but not necc and adds a lot of complexity and dependency -- very nice and simple to use basic
/ CPU-based bitmap rendering)
- OSWin has a WinTex that is blitted up to actual window using GPU code (Draw).
- Master Viewport is uploaded to WinTex first as the "base layer"
- Then DirectUps (e.g., gi3d.Scene) directly upload their own texture to WinTex (note: cannot upload directly to window as this prevents popups and overlays)
- Then any Popups (which have their own Viewports) upload to WinTex.
- Finally if there are any overlays (sprites), then we need a separate transparent texture, OverTex, which critically allows WinTex to remain intact while overlays are updated.
func NewDialogWin ¶
NewDialogWin creates a new dialog window with given internal handle name, display name, and sizing (assumed to be in raw dots), without setting its main viewport -- user should do win.AddChild(vp); win.Viewport = vp to set their own viewport.
func NewMainWindow ¶ added in v0.9.10
NewMainWindow creates a new standard main window with given internal handle name, display name, and sizing, with default positioning, and initializes a viewport within it. The width and height are in standardized "pixel" units (96 per inch), not the actual underlying raw display dot pixels
func NewWindow ¶
func NewWindow(name, title string, opts *oswin.NewWindowOptions) *Window
NewWindow creates a new window with given internal name handle, display name, and options.
func RecycleDialogWin ¶ added in v0.9.10
func RecycleDialogWin(data interface{}, name, title string, width, height int, modal bool) (*Window, bool)
RecycleDialogWin looks for existing window with same Data -- if found brings that to the front, returns true for bool. else (and if data is nil) calls NewDialogWin, and returns false.
func RecycleMainWindow ¶ added in v0.9.10
RecycleMainWindow looks for existing window with same Data -- if found brings that to the front, returns true for bool. else (and if data is nil) calls NewDialogWin, and returns false.
func WindowInFocus ¶ added in v0.9.11
func WindowInFocus() *Window
WindowInFocus returns the window in focus according to oswin. There is a small chance it could be nil.
func (*Window) ActivateSprite ¶
ActivateSprite clears the Inactive flag on the sprite, and increments ActiveSprites, so that it will actually be rendered
func (*Window) AddDirectUploader ¶ added in v0.9.8
AddDirectUploader adds given node to those that have a DirectWinUpload method and directly render to the WinTex via their own method, without going via a Viewport2D as is the case for 2D popups. This is for gi3d.Scene for example.
func (*Window) AddMainMenu ¶
AddMainMenu installs MainMenu as first element of main layout used for dialogs that don't always have a main menu -- returns menubar -- safe to call even if there is a menubar
func (*Window) AddNewSprite ¶ added in v0.9.8
AddNewSprite adds 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.
func (*Window) AddShortcut ¶
AddShortcut adds given shortcut to given action.
func (*Window) AddSprite ¶
AddSprite adds an existing sprite to list of sprites, using the sprite.Name as the unique name key.
func (*Window) BenchmarkFullRender ¶
func (w *Window) BenchmarkFullRender()
BenchmarkFullRender runs benchmark of 50 full re-renders (full restyling, layout, and everything), reporting targeted profile results and generating standard Go cpu.prof and mem.prof outputs.
func (*Window) BenchmarkReRender ¶
func (w *Window) BenchmarkReRender()
BenchmarkReRender runs benchmark of 50 re-render-only updates of display (just the raw rendering, no styling or layout), reporting targeted profile results and generating standard Go cpu.prof and mem.prof outputs.
func (*Window) ClearDragNDrop ¶
func (w *Window) ClearDragNDrop()
ClearDragNDrop clears any existing DND values.
func (*Window) ClearWinUpdating ¶
func (w *Window) ClearWinUpdating()
ClearWinUpdating sets the window updating state to false if not already updating
func (*Window) Close ¶
func (w *Window) Close()
Close closes the window -- this is not a request -- it means: definitely close it -- flags window as such -- check IsClosing()
func (*Window) ClosePopup ¶
ClosePopup close given popup -- must be the current one -- returns false if not.
func (*Window) CloseReq ¶
func (w *Window) CloseReq()
CloseReq requests that the window be closed -- could be rejected
func (*Window) Closed ¶
func (w *Window) Closed()
Closed frees any resources after the window has been closed.
func (*Window) ConfigVLay ¶
func (w *Window) ConfigVLay()
ConfigVLay creates and configures the vertical layout as first child of Viewport, and installs MainMenu as first element of layout.
func (*Window) CurPopupIsTooltip ¶
CurPopupIsTooltip returns true if current popup is a tooltip
func (*Window) DNDClearCursor ¶
func (w *Window) DNDClearCursor()
DNDClearCursor clears any existing DND cursor that might have been set.
func (*Window) DNDDropEvent ¶
DNDDropEvent handles drag-n-drop drop event (action = release).
func (*Window) DNDMoveEvent ¶
DNDMoveEvent handles drag-n-drop move events.
func (*Window) DNDNotCursor ¶
func (w *Window) DNDNotCursor()
DNDNotCursor sets the cursor to Not = can't accept a drop
func (*Window) DNDSetCursor ¶
DNDSetCursor sets the cursor based on the DND event mod -- does a "PushIfNot" so safe for multiple calls.
func (*Window) DNDUpdateCursor ¶
DNDUpdateCursor updates the cursor based on the current DND event mod if different from current (but no update if Not)
func (*Window) DeleteDirectUploader ¶ added in v0.9.8
DeleteDirectUploader removes given node to those that have a DirectWinUpload method.
func (*Window) DeleteShortcut ¶ added in v0.9.14
DeleteShortcut deletes given shortcut
func (*Window) DeleteSprite ¶ added in v0.9.8
DeleteSprite deletes given sprite, returns true if actually deleted User should re-render overlay if returns true.
func (*Window) DeleteTooltip ¶ added in v0.9.11
func (w *Window) DeleteTooltip()
DeleteTooltip deletes any tooltip popup (called when hover ends)
func (*Window) DirectUpdate ¶ added in v0.9.8
DirectUpdate is called when a DirectUpload node wants to update on its own initiative (not as a result of larger update) if there aren't any popups, it can just render, otherwise needs to do UploadAllViewports
func (*Window) DirectUploads ¶ added in v0.9.8
func (w *Window) DirectUploads()
DirectUploads tells directuploaders to upload to WinTex
func (*Window) DisconnectPopup ¶
DisconnectPopup disconnects given popup -- typically the current one.
func (*Window) EventLoop ¶
func (w *Window) EventLoop()
EventLoop runs the event processing loop for the Window -- grabs oswin events for the window and dispatches them to receiving nodes, and manages other state etc (popups, etc).
func (*Window) EventTopNode ¶ added in v0.9.11
func (*Window) EventTopUpdateEnd ¶ added in v0.9.11
func (*Window) EventTopUpdateStart ¶ added in v0.9.11
func (*Window) FilterEvent ¶ added in v0.9.9
FilterEvent filters repeated laggy events -- key for responsive resize, scroll, etc returns false if event should not be processed further, and true if it should.
func (*Window) FinalizeDragNDrop ¶
FinalizeDragNDrop is called by a node to finalize the drag-n-drop operation, after given action has been performed on the target -- allows target to cancel, by sending dnd.DropIgnore.
func (*Window) FocusActiveClick ¶
FocusActiveClick updates the FocusActive status based on mouse clicks in or out of the focused item
func (*Window) FocusInactivate ¶
func (w *Window) FocusInactivate()
FocusInactivate inactivates the current focus element
func (*Window) FocusTopNode ¶ added in v0.9.11
func (*Window) FullReRender ¶
func (w *Window) FullReRender()
FullReRender performs a full re-render of the window -- each node renders into its viewport, aggregating into the main window viewport, which will drive an UploadAllViewports call after all the rendering is done, and signal the publishing of the window after that
func (*Window) GoStartEventLoop ¶
func (w *Window) GoStartEventLoop()
GoStartEventLoop starts the event processing loop for this window in a new goroutine, and returns immediately. Adds to WinWait waitgroup so a main thread can wait on that for all windows to close.
func (*Window) HasGeomPrefs ¶
HasGeomPrefs returns true if geometry prefs were set already
func (*Window) HiPriorityEvents ¶ added in v0.9.9
HiProrityEvents processes High-priority events for Window. Window gets first crack at these events, and handles window-specific ones returns true if processing should continue and false if was handled
func (*Window) InactivateAllSprites ¶
func (w *Window) InactivateAllSprites()
InactivateAllSprites inactivates all sprites
func (*Window) InactivateSprite ¶
InactivateSprite sets the Inactive flag on the sprite, and decrements ActiveSprites, so that it will not be rendered
func (*Window) InitialFocus ¶ added in v0.9.8
func (w *Window) InitialFocus()
InitialFocus establishes the initial focus for the window if no focus is set -- uses ActivateStartFocus or FocusNext as backup.
func (*Window) IsClosing ¶
IsClosing returns true if window has requested to close -- don't attempt to update it any further
func (*Window) IsFocusActive ¶ added in v0.9.11
IsFocusActive returns true if window has focus active flag set
func (*Window) IsInScope ¶
func (w *Window) IsInScope(ni *Node2DBase, popup bool) bool
IsInScope returns true if the given object is in scope for receiving events. If popup is true, then only items on popup are in scope, otherwise items NOT on popup are in scope (if no popup, everything is in scope).
func (*Window) IsResizing ¶
IsResizing means the window is actively being resized by user -- don't try to update otherwise
func (*Window) IsVisible ¶
IsVisible is the main visibility check -- don't do any window updates if not visible!
func (*Window) IsWinUpdating ¶
IsWinUpdating checks if we are already updating window
func (*Window) IsWindowInFocus ¶
IsWindowInFocus returns true if this window is the one currently in focus
func (*Window) KeyChordEventHiPri ¶
func (w *Window) KeyChordEventHiPri(e *key.ChordEvent) bool
KeyChordEventHiPri handles all the high-priority window-specific key events, returning its input on whether any existing popup should be deleted
func (*Window) KeyChordEventLowPri ¶
func (w *Window) KeyChordEventLowPri(e *key.ChordEvent) bool
KeyChordEventLowPri handles all the lower-priority window-specific key events, returning its input on whether any existing popup should be deleted
func (*Window) LogicalDPI ¶
LogicalDPI returns the current logical dots-per-inch resolution of the window, which should be used for most conversion of standard units -- physical DPI can be found in the Screen
func (*Window) MainFrame ¶ added in v0.9.10
MainFrame returns the main widget for this window as a Frame returns error if not there, or not a frame.
func (*Window) MainMenuSet ¶
func (w *Window) MainMenuSet()
MainMenuSet sets the main menu for the window, after window.Focus event
func (*Window) MainMenuUpdateActives ¶
func (w *Window) MainMenuUpdateActives()
MainMenuUpdateActives needs to be called whenever items on the main menu for this window have their IsActive status updated.
func (*Window) MainMenuUpdateWindows ¶
func (w *Window) MainMenuUpdateWindows()
MainMenuUpdateWindows updates a Window menu with a list of active menus.
func (*Window) MainMenuUpdated ¶
func (w *Window) MainMenuUpdated()
MainMenuUpdated needs to be called whenever the main menu for this window is updated in terms of items added or removed.
func (*Window) MainWidget ¶
MainWidget returns the main widget for this window -- 2nd element in MasterVLay -- returns error if not yet set.
func (*Window) MakeOverTex ¶ added in v0.9.8
MakeOverTex makes the OverTex overlay texture if not already there and correct size returns true if needed to make it. must be called under UpMu.Lock()
func (*Window) NeedWinMenuUpdate ¶
NeedWinMenuUpdate returns true if our lastWinMenuUpdate is != WinNewCloseTime
func (*Window) PollEvents ¶ added in v0.9.9
func (w *Window) PollEvents()
PollEvents first tells the main event loop to check for any gui events now and then it runs the event processing loop for the Window as long as there are events to be processed, and then returns.
func (*Window) PopPopup ¶
PopPopup pops current popup off the popup stack and set to current popup. returns true if was actually popped. MUST be called within PopMu.Lock scope!
func (*Window) ProcessEvent ¶ added in v0.9.9
ProcessEvent processes given oswin.Event
func (*Window) Publish ¶
func (w *Window) Publish()
Publish does the final step of updating of the window based on the current texture (and overlay texture if active)
func (*Window) PublishFullReRender ¶ added in v0.9.8
func (w *Window) PublishFullReRender()
PublishFullReRender is called by WinFullReRender on Node2DBase Tells window to do a full update during Publish -- especially important for DirectUpload cases which may get overwritten. Call specifically on large container widgets that might contain direct upload widgets (e.g., TabView, SplitView)
func (*Window) RenderOverlays ¶
func (w *Window) RenderOverlays()
RenderOverlays renders sprites -- clears OverTex, uploads sprites to it
func (*Window) RenderSprite ¶
RenderSprite renders the sprite onto OverTex -- must be called within UpMu mutex lock
func (*Window) ReportWinNodes ¶
func (w *Window) ReportWinNodes()
ReportWinNodes reports the number of nodes in this window
func (*Window) SendCustomEvent ¶
func (w *Window) SendCustomEvent(data interface{})
SendCustomEvent sends a custom event with given data to this window -- widgets can connect to receive CustomEventType events to receive them. Sometimes it is useful to send a custom event just to trigger a pass through the event loop, even if nobody is listening (e.g., if a popup is posted without a surrounding event, as in Complete.ShowCompletions
func (*Window) SendShowEvent ¶
func (w *Window) SendShowEvent()
SendShowEvent sends the WindowShowEvent to anyone listening -- only sent once..
func (*Window) SendWinFocusEvent ¶
SendWinFocusEvent sends the WindowFocusEvent to widgets
func (*Window) SetCloseCleanFunc ¶ added in v0.9.7
SetCloseCleanFunc sets the function that is called whenever window is actually about to close (irrevocably) -- can do any necessary last-minute cleanup here.
func (*Window) SetCloseReqFunc ¶ added in v0.9.7
SetCloseReqFunc sets the function that is called whenever there is a request to close the window (via a OS or a call to CloseReq() method). That function can then adjudicate whether and when to actually call Close.
func (*Window) SetDelPopup ¶
SetDelPopup sets the popup to delete next time through event loop
func (*Window) SetFocusActiveState ¶ added in v0.9.11
SetFocusActiveState sets focus active flag to given state
func (*Window) SetMainFrame ¶
SetMainFrame sets the main widget of this window as a Frame, with a default column-wise vertical layout and max stretch sizing, and returns that frame.
func (*Window) SetMainLayout ¶
SetMainLayout sets the main widget of this window as a Layout, with a default column-wise vertical layout and max stretch sizing, and returns it.
func (*Window) SetMainWidget ¶
SetMainWidget sets given widget as the main widget for the window -- adds into MasterVLay after main menu -- if a main widget has already been set then it is deleted and this one replaces it. Use this method to ensure future compatibility.
func (*Window) SetMainWidgetType ¶
SetMainWidgetType sets the main widget of this window to given type (typically a Layout or Frame), and returns it. Adds into MasterVLay after main menu -- if a main widget has already been set then it is deleted and this one replaces it. Use this method to ensure future compatibility.
func (*Window) SetName ¶
SetName sets name of this window and also the OSWin, and applies any window geometry settings associated with the new name if it is different from before
func (*Window) SetNextPopup ¶
SetNextPopup sets the next popup, and what to focus on in that popup if non-nil
func (*Window) SetPixSize ¶ added in v0.9.10
SetPixSize requests that the window be resized to the given size in underlying pixel coordinates, which means that the requested size is divided by the screen's DevicePixelRatio
func (*Window) SetSize ¶
SetSize requests that the window be resized to the given size in OS window manager specific coordinates, which may be different from the underlying pixel-level resolution of the window. This will trigger a resize event and be processed that way when it occurs.
func (*Window) SetWinUpdating ¶
func (w *Window) SetWinUpdating()
SetWinUpdating sets the window updating state to true if not already updating
func (*Window) ShouldDeletePopupMenu ¶
ShouldDeletePopupMenu returns true if the given popup item should be deleted
func (*Window) SpriteByName ¶ added in v0.9.5
SpriteByName returns a sprite by name -- false if not created yet
func (*Window) StartDragNDrop ¶
StartDragNDrop is called by a node to start a drag-n-drop operation on given source node, which is responsible for providing the data and Sprite representation of the node.
func (*Window) StartEventLoop ¶
func (w *Window) StartEventLoop()
StartEventLoop is the main startup method to call after the initial window configuration is setup -- does any necessary final initialization and then starts the event loop in this same goroutine, and does not return until the window is closed -- see GoStartEventLoop for a version that starts in a separate goroutine and returns immediately.
func (*Window) StopEventLoop ¶
func (w *Window) StopEventLoop()
StopEventLoop tells the event loop to stop running when the next event arrives.
func (*Window) TriggerShortcut ¶
TriggerShortcut attempts to trigger a shortcut, returning true if one was triggered, and false otherwise. Also eliminates any shortcuts with deleted actions, and does not trigger for Inactive actions.
func (*Window) UploadAllViewports ¶
func (w *Window) UploadAllViewports()
UploadAllViewports does a complete upload of all active viewports, in the proper order, so as to completely refresh the window texture based on everything rendered
func (*Window) UploadVp ¶
func (w *Window) UploadVp(vp *Viewport2D, offset image.Point)
UploadVp uploads entire viewport image for given viewport -- e.g., for popups etc updating separately
func (*Window) UploadVpRegion ¶
func (w *Window) UploadVpRegion(vp *Viewport2D, vpBBox, winBBox image.Rectangle)
UploadVpRegion uploads image for one viewport region on the screen, using vpBBox bounding box for the viewport, and winBBox bounding box for the window -- called after re-rendering specific nodes to update only the relevant part of the overall viewport image
func (*Window) WinViewport2D ¶
func (w *Window) WinViewport2D() *Viewport2D
WinViewport2D returns the viewport directly under this window that serves as the master viewport for the entire window.
type WindowGeom ¶
WindowGeom records the geometry settings used for a given window
func (*WindowGeom) FitInSize ¶ added in v0.9.10
func (wg *WindowGeom) FitInSize(sz image.Point)
func (*WindowGeom) Pos ¶
func (wg *WindowGeom) Pos() image.Point
func (*WindowGeom) ScalePos ¶ added in v0.9.10
func (wg *WindowGeom) ScalePos(fact float32)
func (*WindowGeom) ScaleSize ¶ added in v0.9.10
func (wg *WindowGeom) ScaleSize(fact float32)
func (*WindowGeom) SetPos ¶ added in v0.9.10
func (wg *WindowGeom) SetPos(ps image.Point)
func (*WindowGeom) SetSize ¶ added in v0.9.10
func (wg *WindowGeom) SetSize(sz image.Point)
func (*WindowGeom) Size ¶
func (wg *WindowGeom) Size() image.Point
type WindowGeomPrefs ¶
type WindowGeomPrefs map[string]map[string]WindowGeom
WindowGeomPrefs records the window geometry by window name, screen name -- looks up the info automatically for new windows and saves persistently
func (*WindowGeomPrefs) DeleteAll ¶
func (wg *WindowGeomPrefs) DeleteAll()
DeleteAll deletes the file that saves the position and size of each window, by screen, and clear current in-memory cache. You shouldn't need to use this but sometimes useful for testing.
func (*WindowGeomPrefs) LockFile ¶
func (wg *WindowGeomPrefs) LockFile() error
LockFile attempts to create the win_geom_prefs lock file
func (*WindowGeomPrefs) NeedToReload ¶
func (wg *WindowGeomPrefs) NeedToReload() bool
NeedToReload returns true if the last save time of prefs file is more recent than when we last saved
func (*WindowGeomPrefs) Open ¶
func (wg *WindowGeomPrefs) Open() error
Open Window Geom preferences from GoGi standard prefs directory called under mutex or at start
func (*WindowGeomPrefs) Pref ¶
func (wg *WindowGeomPrefs) Pref(winName string, scrn *oswin.Screen) *WindowGeom
Pref returns an existing preference for given window name, or one adapted to given screen if only records are on a different screen -- if scrn is nil then default (first) screen is used from oswin.TheApp if the window name has a colon, only the part prior to the colon is used
func (*WindowGeomPrefs) RecordPref ¶
func (wg *WindowGeomPrefs) RecordPref(win *Window)
RecordPref records current state of window as preference
func (*WindowGeomPrefs) Save ¶
func (wg *WindowGeomPrefs) Save() error
Save Window Geom Preferences to GoGi standard prefs directory assumed to be under mutex and lock still
func (*WindowGeomPrefs) SaveLastSave ¶
func (wg *WindowGeomPrefs) SaveLastSave()
SaveLastSave saves timestamp (now) of last save to win geom
func (*WindowGeomPrefs) UnlockFile ¶
func (wg *WindowGeomPrefs) UnlockFile()
UnLockFile unlocks the win_geom_prefs lock file (just removes it)
type WindowList ¶
type WindowList []*Window
WindowList is a list of windows.
var AllWindows WindowList
AllWindows is the list of all windows that have been created (dialogs, main windows, etc).
var DialogWindows WindowList
DialogWindows is the list of only dialog windows that have been created.
var MainWindows WindowList
MainWindows is the list of main windows (non-dialogs) that have been created.
func (*WindowList) Delete ¶
func (wl *WindowList) Delete(w *Window) bool
Delete removes a window from the list -- returns true if deleted.
func (*WindowList) FindData ¶ added in v0.9.10
func (wl *WindowList) FindData(data interface{}) (*Window, bool)
FindData finds window with given Data on list -- returns window and true if found, nil, false otherwise. data of type string works fine -- does equality comparison on string contents.
func (*WindowList) FindName ¶
func (wl *WindowList) FindName(name string) (*Window, bool)
FindName finds window with given name on list (case sensitive) -- returns window and true if found, nil, false otherwise.
func (*WindowList) FindOSWin ¶ added in v0.9.11
func (wl *WindowList) FindOSWin(osw oswin.Window) (*Window, bool)
FindOSWin finds window with given oswin.Window on list -- returns window and true if found, nil, false otherwise.
func (*WindowList) FocusNext ¶
func (wl *WindowList) FocusNext() (*Window, int)
FocusNext focuses on the next window in the list, after the current Focused() one skips minimized windows
func (*WindowList) Focused ¶
func (wl *WindowList) Focused() (*Window, int)
Focused returns the (first) window in this list that has the WinFlagGotFocus flag set and the index in the list (nil, -1 if not present)
func (*WindowList) Len ¶
func (wl *WindowList) Len() int
Len returns the length of the list, concurrent-safe
func (*WindowList) Win ¶
func (wl *WindowList) Win(idx int) *Window
Win gets window at given index, concurrent-safe
Source Files ¶
- action.go
- align_string.go
- bars.go
- baselineshifts_string.go
- bitmap.go
- borderdrawstyle_string.go
- boxsides_string.go
- boxstyles.go
- buttonbox.go
- buttonflags_string.go
- buttons.go
- buttonsignals_string.go
- buttonstates_string.go
- clipper.go
- color.go
- colorparse.go
- colorsources_string.go
- combobox.go
- complete.go
- completesignals_string.go
- css.go
- dialogs.go
- dialogstate_string.go
- dndstages_string.go
- doc.go
- eventpris_string.go
- events.go
- fillrules_string.go
- focuschanges_string.go
- font.go
- fontstretch_string.go
- fontstyles.go
- fontstyles_string.go
- fontvariants_string.go
- fontweights_string.go
- frame.go
- geom2d.go
- geom3d.go
- icon.go
- keyfun.go
- keyfuns_string.go
- label.go
- labeler.go
- labelstates_string.go
- layout.go
- layouts_string.go
- layoutstyles.go
- linecaps_string.go
- linejoins_string.go
- menus.go
- node.go
- node2d.go
- nodeflags_string.go
- overflow_string.go
- paint.go
- paintstyles.go
- prefs.go
- rowcol_string.go
- sliders.go
- slidersignals_string.go
- sliderstates_string.go
- spell.go
- spellsignals_string.go
- spinbox.go
- splitview.go
- sprite.go
- stripes_string.go
- style.go
- stylefuncs.go
- tabview.go
- tabviewsignals_string.go
- text.go
- textanchors_string.go
- textdecorations_string.go
- textdirections_string.go
- textfield.go
- textfieldsignals_string.go
- textfieldstates_string.go
- textstyles.go
- unicodebidi_string.go
- updater.go
- vectoreffects_string.go
- version.go
- viewport.go
- views.go
- vpflags_string.go
- whitespaces_string.go
- widget.go
- widgetsignals_string.go
- window.go
- winflags_string.go
- wingeom.go