Documentation
¶
Overview ¶
Package Gi (GoGi) provides a Graphical Interface based on GoKi Tree Node structs
2D and 3D scenegraphs supported, each rendering to respective Viewport2D or 3D which in turn can be integrated within the other type of scenegraph.
Within 2D scenegraph, the following are supported
- SVG-based rendering nodes for basic shapes, paths, curves, arcs
- Widget nodes for GUI actions (Buttons, Views etc)
- Layouts for placing widgets
- CSS-based styling, directly on Node Props (properties), and css sheets
- HTML elements -- the 2D scenegraph can render html documents
Layout Logic ¶
For Widget-based displays, *everything* should be contained in a Layout, because a layout provides the primary logic for organizing widgets within the constraints of the display. Typically start with a vertical LayoutCol in a viewport, with LayoutCol's within that, or a LayoutGrid for more complex layouts:
win := gi.NewWindow2D("test window", width, height) vp := win.WinViewport2D() updt := vp.UpdateStart() vpfill := vp.AddNewChildNamed(gi.KiT_Viewport2DFill, "vpfill").(*gi.Viewport2DFill) vpfill.SetProp("fill", "#FFF") // white background vlay := vpfill.AddNewChildNamed(gi.KiT_Layout, "vlay").(*gi.Layout) vlay.Lay = gi.LayoutCol row1 := vlay.AddNewChildNamed(gi.KiT_Layout, "row1").(*gi.Layout) row1.Lay = gi.LayoutRow ... 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 minumum 1em in preferred size.
align-horiz / align-vert: for the other dimension in a Layout (e.g., for LayoutRow, 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 LayoutRow) 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).
Signals ¶
All widgets send appropriate signals about user actions -- Connect to those and check the signal type to determine the type of event.
Views ¶
Views are Widgets that automatically display and interact with structured data, providing powerful GUI elements, with extensive property-based customization options. They can easily provide the foundation for entire apps.
TreeView ¶
The TreeView displays GoKi Node Trees, using a standard tree-browser with collapse / open widgets and a menu for typical actions such as adding and deleting child nodes, along with full drag-n-drop and clipboard Copy/Cut/Paste functionality. You can connect to the selection signal to e.g., display a StructView field / property editor of the selected node.
The properties controlling the TreeView include:
- "view-closed" -- node starts out closed (default is open)
- "background-color" -- color of the background of node box
- "color" -- font color in rendering node label
- "inactive" -- do not display the editing menu actions
StructView ¶
The StructView displays an arbitrary struct object, showing its fields and values, in an editable form, with type-appropriate widgets.
Index ¶
- Variables
- func AggCSS(agg *ki.Props, css ki.Props)
- func ApplyCSS(node Node2D, key string, css ki.Props) bool
- func Degrees(radians float32) float32
- func FixedToFloat32(x fixed.Int26_6) float32
- func Float32ToFixed(x float32) fixed.Int26_6
- func Float32ToFixedPoint(x, y float32) fixed.Point26_6
- func FloatMod(val, mod float64) float64
- func FloatMod32(val, mod float32) float32
- func GoGiEditorOf(obj ki.Ki)
- func HSLtoRGBf32(h, s, l float32) (r, g, b float32)
- func InRange(val, min, max float64) float64
- func InRange32(val, min, max float32) float32
- func InRangeInt(val, min, max int) int
- func Init()
- func Init2DButtonEvents(bw ButtonWidget)
- func IsAlignEnd(a Align) bool
- func IsAlignMiddle(a Align) bool
- func IsAlignStart(a Align) bool
- func KiToNode2D(k ki.Ki) (Node2D, *Node2DBase)
- func LoadFontFace(path string, points float64) (font.Face, error)
- func LoadImage(path string) (image.Image, error)
- func LoadPNG(path string) (image.Image, error)
- func Max32(a, b float32) float32
- func MaxInt(a, b int) int
- func MeasureChars(f font.Face, s string) []float32
- func Min32(a, b float32) float32
- func MinInt(a, b int) int
- func MinPos(a, b float64) float64
- func MinPos32(a, b float32) float32
- func NewKiDialogValues(dlg *Dialog) (int, reflect.Type)
- func PathDataRender(data []PathData, pc *Paint, rs *RenderState)
- func PopupIsMenu(pop ki.Ki) bool
- func PromptDialog(avp *Viewport2D, title, prompt string, ok, cancel bool, recv ki.Ki, ...)
- func RGBtoHSLf32(r, g, b float32) (h, s, l float32)
- func Radians(degrees float32) float32
- func RectFromPosSize(pos, sz Vec2D) image.Rectangle
- func SavePNG(path string, im image.Image) error
- func SetButtonIcon(bw ButtonWidget, ic *Icon)
- func SetButtonText(bw ButtonWidget, txt string)
- func SignalViewport2D(vpki, send ki.Ki, sig int64, data interface{})
- func SignalWindowFlush(winki, node ki.Ki, sig int64, data interface{})
- func SrcNodeSignal(tvki, send ki.Ki, sig int64, data interface{})
- func StringPromptDialogValue(dlg *Dialog) string
- func StyleCSSWidget(node Node2D, css ki.Props)
- func StyleEffTag(tag, outerTag string) string
- func StyleUnitsValue(tag string, uv *units.Value, props ki.Props) bool
- func TabButtonClicked(recv, send ki.Ki, sig int64, d interface{})
- func ToLabel(it interface{}) string
- func Truncate(val float64, prec int) float64
- func Truncate32(val float32, prec int) float32
- func WalkStyleStruct(obj interface{}, outerTag string, baseoff uintptr, fun WalkStyleFieldFunc)
- type Action
- type Align
- type BackgroundStyle
- type BoolValueView
- type BorderDrawStyle
- type BorderStyle
- type BoxSides
- type Button
- type ButtonBase
- func (g *ButtonBase) AddMenuText(txt string, sigTo ki.Ki, data interface{}, fun ki.RecvFunc) *Action
- func (g *ButtonBase) AddSeparator(name string) *Separator
- func (g *ButtonBase) ButtonAsBase() *ButtonBase
- func (g *ButtonBase) ButtonEnterHover()
- func (g *ButtonBase) ButtonExitHover()
- func (g *ButtonBase) ButtonPressed()
- func (g *ButtonBase) ButtonRelease()
- func (g *ButtonBase) ButtonReleased()
- func (g *ButtonBase) ConfigParts()
- func (g *ButtonBase) ConfigPartsAddIndicator(config *kit.TypeAndNameList, defOn bool) int
- func (g *ButtonBase) ConfigPartsIfNeeded()
- func (g *ButtonBase) ConfigPartsIndicator(indIdx int)
- func (g *ButtonBase) FocusChanged2D(gotFocus bool)
- func (g *ButtonBase) HasMenu() bool
- func (g *ButtonBase) Init2D()
- func (g *ButtonBase) IsCheckable() bool
- func (g *ButtonBase) IsChecked() bool
- func (g *ButtonBase) IsMenu() bool
- func (g *ButtonBase) IsSelected() bool
- func (g *ButtonBase) Layout2D(parBBox image.Rectangle)
- func (n *ButtonBase) New() ki.Ki
- func (g *ButtonBase) OpenMenu() bool
- func (g *ButtonBase) Render2D()
- func (g *ButtonBase) Render2DDefaultStyle()
- func (g *ButtonBase) ResetMenu()
- func (g *ButtonBase) SetAsButton()
- func (g *ButtonBase) SetAsMenu()
- func (g *ButtonBase) SetButtonState(state ButtonStates)
- func (g *ButtonBase) SetCheckable(checkable bool)
- func (g *ButtonBase) SetChecked(chk bool)
- func (g *ButtonBase) SetIcon(ic *Icon)
- func (g *ButtonBase) SetSelected(sel bool)
- func (g *ButtonBase) SetText(txt string)
- func (g *ButtonBase) Style2D()
- func (g *ButtonBase) Style2DWidget()
- func (g *ButtonBase) ToggleChecked()
- type ButtonSignals
- type ButtonStates
- type ButtonWidget
- type CheckBox
- type Circle
- type 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) IsNil() 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) Saturate(pct float32) Color
- 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) SetInt(r, g, b, a int)
- func (c *Color) SetNPFloat32(r, g, b, a float32)
- func (c *Color) SetString(str string, base color.Color) 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) ToFloat32() (r, g, b, a float32)
- func (c *Color) ToHSLA() (h, s, l, a float32)
- func (c Color) ToNPFloat32() (r, g, b, a float32)
- func (cl Color) ValueView() ValueView
- type ColorValueView
- type ColorView
- func (sv *ColorView) ButtonBox() (*Layout, int)
- func (sv *ColorView) Config()
- func (sv *ColorView) ConfigHSLSlider(sl *Slider, hsl int)
- func (sv *ColorView) ConfigLabel(lab *Label, txt string)
- func (sv *ColorView) ConfigRGBSlider(sl *Slider, rgb int)
- func (sv *ColorView) ConfigSliderGrid()
- func (n *ColorView) New() ki.Ki
- func (sv *ColorView) ReRender2D() (node Node2D, layout bool)
- func (sv *ColorView) Render2D()
- func (sv *ColorView) SetColor(color *Color, tmpSave ValueView)
- func (sv *ColorView) SetFrame()
- func (sv *ColorView) SetHSLValue(val float32, hsl int)
- func (sv *ColorView) SetRGBValue(val float32, rgb int)
- func (sv *ColorView) SetTitle(title string)
- func (sv *ColorView) SliderGrid() (*Layout, int)
- func (sv *ColorView) StdFrameConfig() kit.TypeAndNameList
- func (sv *ColorView) StdSliderConfig() kit.TypeAndNameList
- func (sv *ColorView) StdValueLayConfig() kit.TypeAndNameList
- func (sv *ColorView) Style2D()
- func (sv *ColorView) TitleWidget() (*Label, int)
- func (sv *ColorView) Update()
- func (sv *ColorView) UpdateHSLSlider(sl *Slider, hsl int)
- func (sv *ColorView) UpdateRGBSlider(sl *Slider, rgb int)
- func (sv *ColorView) UpdateSliderGrid()
- func (sv *ColorView) Value() (*Frame, int)
- func (sv *ColorView) ValueLay() (*Layout, int)
- func (sv *ColorView) ValueLayConfig()
- type ComboBox
- func (g *ComboBox) ButtonAsBase() *ButtonBase
- func (g *ComboBox) ButtonRelease()
- func (g *ComboBox) ConfigParts()
- func (g *ComboBox) ConfigPartsIfNeeded()
- func (g *ComboBox) FindItem(it interface{}) int
- func (g *ComboBox) FocusChanged2D(gotFocus bool)
- func (g *ComboBox) Init2D()
- func (g *ComboBox) ItemsFromEnum(enumtyp reflect.Type, setFirst bool, maxLen int)
- func (g *ComboBox) ItemsFromEnumList(el []kit.EnumValue, setFirst bool, maxLen int)
- func (g *ComboBox) ItemsFromTypes(tl []reflect.Type, setFirst, sort bool, maxLen int)
- func (g *ComboBox) Layout2D(parBBox image.Rectangle)
- func (g *ComboBox) MakeItems(reset bool, capacity int)
- func (g *ComboBox) MakeItemsMenu()
- func (n *ComboBox) New() ki.Ki
- func (g *ComboBox) Render2D()
- func (g *ComboBox) Render2DDefaultStyle()
- func (g *ComboBox) SelectItem(idx int)
- func (g *ComboBox) SetCurIndex(idx int) interface{}
- func (g *ComboBox) SetCurVal(it interface{}) int
- func (g *ComboBox) SetIcon(ic *Icon)
- func (g *ComboBox) SetText(txt string)
- func (g *ComboBox) SetToMaxLength(maxLen int)
- func (g *ComboBox) Size2D()
- func (g *ComboBox) SortItems(ascending bool)
- func (g *ComboBox) Style2D()
- type Dialog
- func ColorViewDialog(avp *Viewport2D, clr *Color, tmpSave ValueView, title, prompt string, ...) *Dialog
- func MapViewDialog(avp *Viewport2D, mp interface{}, tmpSave ValueView, title, prompt string, ...) *Dialog
- func NewKiDialog(avp *Viewport2D, iface reflect.Type, title, prompt string, recv ki.Ki, ...) *Dialog
- func NewStdDialog(name, title, prompt string, ok, cancel bool) *Dialog
- func SliceViewDialog(avp *Viewport2D, mp interface{}, tmpSave ValueView, title, prompt string, ...) *Dialog
- func StringPromptDialog(avp *Viewport2D, strval, title, prompt string, recv ki.Ki, fun ki.RecvFunc) *Dialog
- func StructViewDialog(avp *Viewport2D, stru interface{}, tmpSave ValueView, title, prompt string, ...) *Dialog
- func (dlg *Dialog) Accept()
- func (dlg *Dialog) AddButtonBox(spaceBefore float32, stretchBefore bool, frame *Frame) *Layout
- func (dlg *Dialog) ButtonBox(frame *Frame) (*Layout, int)
- func (dlg *Dialog) Cancel()
- func (dlg *Dialog) Close()
- func (dlg *Dialog) Frame() *Frame
- func (dlg *Dialog) HasFocus2D() bool
- func (dlg *Dialog) Init2D()
- func (n *Dialog) New() ki.Ki
- func (dlg *Dialog) Open(x, y int, avp *Viewport2D) bool
- func (dlg *Dialog) PromptWidget(frame *Frame) (*Label, int)
- func (dlg *Dialog) SetFrame() *Frame
- func (dlg *Dialog) SetPrompt(prompt string, spaceBefore float32, 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 Dims2D
- type Ellipse
- type EnumValueView
- type FieldValueViewer
- type FillRule
- type FillStyle
- type FloatValueView
- type FontLib
- type FontStyle
- type FontStyles
- type FontWeights
- type Frame
- type HSLA
- type Icon
- type IconContexts
- type IconSet
- type ImagePaintServer
- type IntValueView
- type KeyFunctions
- type KeyMap
- type KiPtrValueView
- type Label
- type Labeler
- type Layout
- func (ly *Layout) AllocFromParent()
- func (g *Layout) AsLayout2D() *Layout
- func (ly *Layout) AsNode2D() *Node2DBase
- func (ly *Layout) AsViewport2D() *Viewport2D
- func (ly *Layout) AvailSize() Vec2D
- func (ly *Layout) BBox2D() image.Rectangle
- func (g *Layout) CSSProps() (css, agg *ki.Props)
- func (ly *Layout) ChildrenBBox2D() image.Rectangle
- func (ly *Layout) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)
- func (ly *Layout) DeactivateScroll(sc *ScrollBar)
- func (ly *Layout) DeleteScroll(d Dims2D)
- func (ly *Layout) FinalizeLayout()
- func (ly *Layout) FocusChanged2D(gotFocus bool)
- func (ly *Layout) GatherSizes()
- func (ly *Layout) GatherSizesGrid()
- func (ly *Layout) Init2D()
- func (ly *Layout) Layout2D(parBBox image.Rectangle)
- func (ly *Layout) LayoutAll(dim Dims2D)
- func (ly *Layout) LayoutGrid()
- func (ly *Layout) LayoutGridDim(rowcol RowCol, dim Dims2D)
- func (ly *Layout) LayoutScrolls()
- func (ly *Layout) LayoutSingle(dim Dims2D)
- func (ly *Layout) LayoutSingleImpl(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) Move2DDelta(delta image.Point) image.Point
- func (n *Layout) New() ki.Ki
- func (ly *Layout) ReRender2D() (node Node2D, layout bool)
- func (ly *Layout) Render2D()
- func (ly *Layout) Render2DChildren()
- func (ly *Layout) RenderScrolls()
- func (ly *Layout) ScrollDelta(del image.Point) bool
- func (ly *Layout) SetScroll(d Dims2D)
- func (ly *Layout) ShowChildAtIndex(idx int) error
- func (ly *Layout) Size2D()
- func (ly *Layout) Style2D()
- func (ly *Layout) SumDim(d Dims2D) bool
- type LayoutData
- type LayoutStyle
- type Layouts
- type Line
- type LineCap
- type LineJoin
- type MakeMenuFunc
- type MapInlineValueView
- type MapValueView
- type MapView
- func (mv *MapView) ButtonBox() (*Layout, int)
- func (mv *MapView) ConfigMapButtons()
- func (mv *MapView) ConfigMapGrid()
- func (mv *MapView) MapAdd()
- func (mv *MapView) MapChangeValueType(idx int, typ reflect.Type)
- func (mv *MapView) MapDelete(key reflect.Value)
- func (mv *MapView) MapGrid() (*Layout, int)
- func (n *MapView) New() ki.Ki
- func (mv *MapView) ReRender2D() (node Node2D, layout bool)
- func (mv *MapView) Render2D()
- func (mv *MapView) SetFrame()
- func (mv *MapView) SetMap(mp interface{}, tmpSave ValueView)
- func (mv *MapView) SetTitle(title string)
- func (mv *MapView) StdConfig() (mods, updt bool)
- func (mv *MapView) StdFrameConfig() kit.TypeAndNameList
- func (mv *MapView) Style2D()
- func (mv *MapView) TitleWidget() (*Label, int)
- func (mv *MapView) UpdateFromMap()
- func (mv *MapView) UpdateValues()
- type MapViewInline
- func (mv *MapViewInline) ConfigParts()
- func (n *MapViewInline) New() ki.Ki
- func (mv *MapViewInline) ReRender2D() (node Node2D, layout bool)
- func (mv *MapViewInline) Render2D()
- func (mv *MapViewInline) SetMap(mp interface{}, tmpSave ValueView)
- func (mv *MapViewInline) Style2D()
- func (mv *MapViewInline) UpdateFromMap()
- func (mv *MapViewInline) UpdateValues()
- type Margins
- type MenuButton
- type NRGBAf32
- type Node2D
- type Node2DBase
- func (g *Node2DBase) AddParentPos() Vec2D
- func (g *Node2DBase) AsLayout2D() *Layout
- func (g *Node2DBase) AsNode2D() *Node2DBase
- func (g *Node2DBase) AsViewport2D() *Viewport2D
- func (g *Node2DBase) BBox2D() image.Rectangle
- func (g *Node2DBase) BBoxFromAlloc() image.Rectangle
- func (g *Node2DBase) BBoxReport() string
- func (g *Node2DBase) CSSProps() (css, agg *ki.Props)
- func (g *Node2DBase) ChildrenBBox2D() image.Rectangle
- func (g *Node2DBase) ChildrenBBox2DWidget() image.Rectangle
- func (g *Node2DBase) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)
- func (g *Node2DBase) ComputeBBox2DBase(parBBox image.Rectangle, delta image.Point)
- func (g *Node2DBase) CopyParentPaint() *Node2DBase
- func (g *Node2DBase) DefaultStyle2DWidget(selector string, part *Node2DBase) *Style
- func (g *Node2DBase) FocusChanged2D(gotFocus bool)
- func (g *Node2DBase) FullRender2DTree()
- func (g *Node2DBase) HasFocus2D() bool
- func (g *Node2DBase) Init2D()
- func (g *Node2DBase) Init2DBase()
- func (g *Node2DBase) Init2DTree()
- func (g *Node2DBase) InitLayout2D()
- func (g *Node2DBase) Layout2D(parBBox image.Rectangle)
- func (g *Node2DBase) Layout2DBase(parBBox image.Rectangle, initStyle bool)
- func (g *Node2DBase) Layout2DChildren()
- func (g *Node2DBase) Layout2DTree()
- func (g *Node2DBase) Move2D(delta image.Point, parBBox image.Rectangle)
- func (g *Node2DBase) Move2DBase(delta image.Point, parBBox image.Rectangle)
- func (g *Node2DBase) Move2DChildren(delta image.Point)
- func (g *Node2DBase) Move2DTree()
- func (n *Node2DBase) New() ki.Ki
- func (g *Node2DBase) ParentLayout() *Layout
- func (g *Node2DBase) ParentReRenderAnchor() Node2D
- func (g *Node2DBase) ParentSVG() *SVG
- func (g *Node2DBase) ParentViewport() *Viewport2D
- func (g *Node2DBase) ParentWindow() *Window
- func (g *Node2DBase) PopBounds()
- func (g *Node2DBase) PushBounds() bool
- func (g *Node2DBase) ReRender2D() (node Node2D, layout bool)
- func (g *Node2DBase) ReRender2DTree()
- func (g *Node2DBase) ReceiveEventType(et oswin.EventType, fun ki.RecvFunc)
- func (g *Node2DBase) Render2D()
- func (g *Node2DBase) Render2DChildren()
- func (g *Node2DBase) Render2DTree()
- func (g *Node2DBase) SetFixedHeight(val units.Value)
- func (g *Node2DBase) SetFixedWidth(val units.Value)
- func (g *Node2DBase) SetMinPrefHeight(val units.Value)
- func (g *Node2DBase) SetMinPrefWidth(val units.Value)
- func (g *Node2DBase) SetStretchMaxHeight()
- func (g *Node2DBase) SetStretchMaxWidth()
- func (g *Node2DBase) SetWinBBox()
- func (g *Node2DBase) Size2D()
- func (g *Node2DBase) Size2DTree()
- func (g *Node2DBase) Style2D()
- func (g *Node2DBase) Style2DSVG()
- func (g *Node2DBase) Style2DTree()
- func (g *Node2DBase) Style2DWidget()
- func (g *Node2DBase) StylePart(pk ki.Ki)
- type Node3DBase
- type NodeBase
- func (g *NodeBase) CanFocus() bool
- func (g *NodeBase) ClearFullReRender()
- func (g *NodeBase) DisconnectAllEvents(win *Window)
- func (g *NodeBase) DisconnectAllEventsTree(win *Window)
- func (g *NodeBase) GrabFocus()
- func (g *NodeBase) HasFocus() bool
- func (g *NodeBase) IsDragging() bool
- func (g *NodeBase) IsInactive() bool
- func (g *NodeBase) IsReRenderAnchor() bool
- func (g *NodeBase) NeedsFullReRender() bool
- func (n *NodeBase) New() ki.Ki
- func (g *NodeBase) ParentWindow() *Window
- func (g *NodeBase) PointToRelPos(pt image.Point) image.Point
- func (g *NodeBase) ReceiveEventType(et oswin.EventType, fun ki.RecvFunc)
- func (g *NodeBase) SetCanFocusIfActive()
- func (g *NodeBase) SetFullReRender()
- func (g *NodeBase) SetInactive()
- func (g *NodeBase) SetInactiveState(readOnly bool)
- func (g *NodeBase) SetReRenderAnchor()
- func (g *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 []Vec2D) 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) CopyFrom(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, x, y, rx, ry, angle1, angle2 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 []Vec2D)
- func (pc *Paint) DrawPolyline(rs *RenderState, points []Vec2D)
- 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) DrawString(rs *RenderState, s string, x, y, width float32)
- func (pc *Paint) DrawStringAnchored(rs *RenderState, s string, x, y, ax, ay, width float32)
- func (pc *Paint) DrawStringLines(rs *RenderState, lines []string, x, y, width, height float32)
- func (pc *Paint) DrawStringLinesAnchored(rs *RenderState, lines []string, x, y, ax, ay, width, h, lineHeight float32)
- func (pc *Paint) DrawStringWrapped(rs *RenderState, s string, x, y, ax, ay, width, lineHeight float32)
- func (pc *Paint) Fill(rs *RenderState)
- func (pc *Paint) FillBox(rs *RenderState, pos, size Vec2D, clr color.Color)
- func (pc *Paint) FillPreserve(rs *RenderState)
- func (pc *Paint) FillStrokeClear(rs *RenderState)
- func (pc *Paint) FontHeight() float32
- func (pc *Paint) HasFill() bool
- func (pc *Paint) HasNoStrokeOrFill() bool
- func (pc *Paint) HasStroke() bool
- func (pc *Paint) Identity()
- func (pc *Paint) InvertY(rs *RenderState)
- func (pc *Paint) LineTo(rs *RenderState, x, y float32)
- func (pc *Paint) LoadFontFace(path string, points float64) error
- func (pc *Paint) MeasureChars(s string) []float32
- func (pc *Paint) MeasureString(s string) (w, h float32)
- func (pc *Paint) MeasureStringWrapped(s string, width, lineHeight float32) ([]string, 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) SetFontFace(fontFace font.Face)
- func (pc *Paint) SetMask(rs *RenderState, mask *image.Alpha) error
- func (pc *Paint) SetPixel(rs *RenderState, x, y int)
- func (pc *Paint) SetStyle(parent *Paint, props ki.Props)
- func (pc *Paint) SetUnitContext(vp *Viewport2D, el Vec2D)
- 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) ToDots()
- func (pc *Paint) TransformPoint(rs *RenderState, x, y float32) Vec2D
- func (pc *Paint) Translate(x, y float32)
- func (pc *Paint) WordWrap(s string, w float32) []string
- type PaintServer
- type PaintServers
- type Path
- type PathCmds
- type PathData
- type Polygon
- type Polyline
- type Preferences
- type RGBAf32
- type Rect
- type Region2D
- type RegionMap2D
- type RenderState
- type RepeatOp
- type RowCol
- type SVG
- type ScreenPrefs
- type ScrollBar
- func (g *ScrollBar) Defaults()
- func (g *ScrollBar) FocusChanged2D(gotFocus bool)
- func (g *ScrollBar) Init2D()
- func (g *ScrollBar) Layout2D(parBBox image.Rectangle)
- func (n *ScrollBar) New() ki.Ki
- func (g *ScrollBar) Render2D()
- func (g *ScrollBar) Render2DDefaultStyle()
- func (g *ScrollBar) Size2D()
- func (g *ScrollBar) Style2D()
- type Separator
- type ShadowStyle
- type SizePrefs
- type SliceValueView
- type SliceView
- func (sv *SliceView) ButtonBox() (*Layout, int)
- func (sv *SliceView) ConfigSliceButtons()
- func (sv *SliceView) ConfigSliceGrid()
- func (n *SliceView) New() ki.Ki
- func (sv *SliceView) ReRender2D() (node Node2D, layout bool)
- func (sv *SliceView) Render2D()
- func (sv *SliceView) SetFrame()
- func (sv *SliceView) SetSlice(sl interface{}, tmpSave ValueView)
- func (sv *SliceView) SetTitle(title string)
- func (sv *SliceView) SliceDelete(idx int)
- func (sv *SliceView) SliceGrid() (*Layout, int)
- func (sv *SliceView) SliceNewAt(idx int)
- func (sv *SliceView) StdConfig() (mods, updt bool)
- func (sv *SliceView) StdFrameConfig() kit.TypeAndNameList
- func (sv *SliceView) Style2D()
- func (sv *SliceView) TitleWidget() (*Label, int)
- func (sv *SliceView) UpdateFromSlice()
- func (sv *SliceView) UpdateValues()
- type SliceViewInline
- func (sv *SliceViewInline) ConfigParts()
- func (n *SliceViewInline) New() ki.Ki
- func (sv *SliceViewInline) ReRender2D() (node Node2D, layout bool)
- func (sv *SliceViewInline) Render2D()
- func (sv *SliceViewInline) SetSlice(sl interface{}, tmpSave ValueView)
- func (sv *SliceViewInline) Style2D()
- func (sv *SliceViewInline) UpdateFromSlice()
- func (sv *SliceViewInline) UpdateValues()
- type Slider
- func (g *Slider) Defaults()
- func (g *Slider) FocusChanged2D(gotFocus bool)
- func (g *Slider) Init2D()
- func (g *Slider) Layout2D(parBBox image.Rectangle)
- func (n *Slider) New() ki.Ki
- func (g *Slider) Render2D()
- func (g *Slider) Render2DDefaultStyle()
- func (g *Slider) Size2D()
- func (g *Slider) Style2D()
- type SliderBase
- func (g *SliderBase) ConfigParts()
- func (g *SliderBase) ConfigPartsIfNeeded(render bool)
- func (g *SliderBase) Defaults()
- func (g *SliderBase) Init2DSlider()
- func (g *SliderBase) KeyInput(kt *key.ChordEvent)
- func (n *SliderBase) New() ki.Ki
- func (g *SliderBase) PointToRelPos(pt image.Point) image.Point
- func (g *SliderBase) SetSliderPos(pos float32)
- func (g *SliderBase) SetSliderState(state SliderStates)
- func (g *SliderBase) SetThumbValue(val float32)
- func (g *SliderBase) SetValue(val float32)
- func (g *SliderBase) SetValueAction(val float32)
- func (g *SliderBase) SizeFromAlloc()
- func (g *SliderBase) SliderEnterHover()
- func (g *SliderBase) SliderExitHover()
- func (g *SliderBase) SliderMoved(start, end float32)
- func (g *SliderBase) SliderPressed(pos float32)
- func (g *SliderBase) SliderReleased()
- func (g *SliderBase) SnapValue()
- func (g *SliderBase) UpdatePosFromValue()
- func (g *SliderBase) UpdateThumbValSize()
- type SliderSignals
- type SliderStates
- type SolidcolorPaintServer
- type Space
- type SpinBox
- func (g *SpinBox) ConfigParts()
- func (g *SpinBox) ConfigPartsIfNeeded()
- func (g *SpinBox) Defaults()
- func (g *SpinBox) IncrValue(steps float32)
- func (g *SpinBox) Init2D()
- func (g *SpinBox) Layout2D(parBBox image.Rectangle)
- func (n *SpinBox) New() ki.Ki
- func (g *SpinBox) Render2D()
- func (g *SpinBox) SetMax(max float32)
- func (g *SpinBox) SetMin(min float32)
- func (g *SpinBox) SetMinMax(hasMin bool, min float32, hasMax bool, max float32)
- func (g *SpinBox) SetValue(val float32)
- func (g *SpinBox) SetValueAction(val float32)
- func (g *SpinBox) Size2D()
- func (g *SpinBox) Style2D()
- type SplitView
- func (g *SplitView) CollapseChild(save bool, idxs ...int)
- func (g *SplitView) ConfigSplitters()
- func (g *SplitView) Init2D()
- func (g *SplitView) Layout2D(parBBox image.Rectangle)
- func (n *SplitView) New() ki.Ki
- func (g *SplitView) ReRender2D() (node Node2D, layout bool)
- func (g *SplitView) Render2D()
- func (g *SplitView) RestoreSplits()
- func (g *SplitView) SaveSplits()
- func (g *SplitView) SetSplits(splits ...float32)
- func (g *SplitView) SetSplitsAction(idx int, nwval float32)
- func (g *SplitView) Style2D()
- func (g *SplitView) UpdateSplits()
- type Splitter
- func (g *Splitter) ConfigPartsIfNeeded(render bool)
- func (g *Splitter) Defaults()
- func (g *Splitter) FocusChanged2D(gotFocus bool)
- func (g *Splitter) Init2D()
- func (g *Splitter) Layout2D(parBBox image.Rectangle)
- func (n *Splitter) New() ki.Ki
- func (g *Splitter) ReRender2D() (node Node2D, layout bool)
- func (g *Splitter) Render2D()
- func (g *Splitter) Render2DDefaultStyle()
- func (g *Splitter) Size2D()
- func (g *Splitter) Style2D()
- type Stretch
- type StrokeStyle
- type StructInlineValueView
- type StructValueView
- type StructView
- func (sv *StructView) ButtonBox() (*Layout, int)
- func (sv *StructView) ConfigStructGrid()
- func (n *StructView) New() ki.Ki
- func (sv *StructView) ReRender2D() (node Node2D, layout bool)
- func (sv *StructView) Render2D()
- func (sv *StructView) SetFrame()
- func (sv *StructView) SetStruct(st interface{}, tmpSave ValueView)
- func (sv *StructView) SetTitle(title string)
- func (sv *StructView) StdConfig() (mods, updt bool)
- func (sv *StructView) StdFrameConfig() kit.TypeAndNameList
- func (sv *StructView) StructGrid() (*Layout, int)
- func (sv *StructView) Style2D()
- func (sv *StructView) TitleWidget() (*Label, int)
- func (sv *StructView) UpdateFields()
- func (sv *StructView) UpdateFromStruct()
- type StructViewInline
- func (sv *StructViewInline) ConfigParts()
- func (n *StructViewInline) New() ki.Ki
- func (sv *StructViewInline) ReRender2D() (node Node2D, layout bool)
- func (sv *StructViewInline) Render2D()
- func (sv *StructViewInline) SetStruct(st interface{}, tmpSave ValueView)
- func (sv *StructViewInline) UpdateFields()
- func (sv *StructViewInline) UpdateFromStruct()
- type Style
- type StyledField
- type StyledFields
- func (sf *StyledFields) AddField(def interface{}, fieldName string) error
- func (sf *StyledFields) CompileFields(def interface{})
- func (sf *StyledFields) Inherit(obj, par interface{})
- func (sf *StyledFields) Init(def interface{})
- func (sf *StyledFields) Style(obj, par interface{}, props ki.Props)
- func (sf *StyledFields) ToDots(obj interface{}, uc *units.Context)
- type TabView
- func (g *TabView) InitTabView()
- func (g *TabView) InitTabs()
- func (n *TabView) New() ki.Ki
- func (g *TabView) SelectTabIndex(idx int) error
- func (g *TabView) SetSrcNode(k ki.Ki)
- func (g *TabView) TabColLayout() *Layout
- func (g *TabView) TabFrameAtIndex(idx int) *Frame
- func (g *TabView) TabRowLayout() *Layout
- func (g *TabView) TabStackLayout() *Layout
- func (g *TabView) UnselectAllTabButtons()
- type TabViewSignals
- type Text2D
- type TextField
- func (g *TextField) AutoScroll()
- func (g *TextField) CursorBackspace(steps int)
- func (g *TextField) CursorBackward(steps int)
- func (g *TextField) CursorDelete(steps int)
- func (g *TextField) CursorEnd()
- func (g *TextField) CursorForward(steps int)
- func (g *TextField) CursorKill()
- func (g *TextField) CursorStart()
- func (g *TextField) EditDone()
- func (g *TextField) FocusChanged2D(gotFocus bool)
- func (g *TextField) Init2D()
- func (g *TextField) InsertAtCursor(str string)
- func (g *TextField) KeyInput(kt *key.ChordEvent)
- func (g *TextField) Layout2D(parBBox image.Rectangle)
- func (n *TextField) New() ki.Ki
- func (g *TextField) PixelToCursor(pixOff float32) int
- func (g *TextField) Render2D()
- func (g *TextField) RenderCursor()
- func (g *TextField) RevertEdit()
- func (g *TextField) SetCursorFromPixel(pixOff float32)
- func (g *TextField) SetText(txt string)
- func (g *TextField) Size2D()
- func (g *TextField) StartCharPos(idx int) float32
- func (g *TextField) Style2D()
- func (g *TextField) TextWidth(st, ed int) float32
- func (g *TextField) UpdateCharPos() bool
- type TextFieldSignals
- type TextFieldStates
- type TextStyle
- type Transform3D
- type TreeView
- func (tv *TreeView) BBox2D() image.Rectangle
- func (tv *TreeView) ChildrenBBox2D() image.Rectangle
- func (tv *TreeView) ClearSelectMods()
- func (tv *TreeView) Close()
- func (tv *TreeView) ConfigParts()
- func (tv *TreeView) ConfigPartsIfNeeded()
- func (tv *TreeView) FocusChanged2D(gotFocus bool)
- func (tv *TreeView) HasClosedParent() bool
- func (tv *TreeView) Init2D()
- func (tv *TreeView) IsClosed() bool
- func (tv *TreeView) IsSelected() bool
- func (tv *TreeView) Label() string
- func (tv *TreeView) Layout2D(parBBox image.Rectangle)
- func (tv *TreeView) Layout2DParts(parBBox image.Rectangle)
- func (tv *TreeView) MakeMenu(mb *ButtonBase)
- func (tv *TreeView) MoveDown()
- func (tv *TreeView) MoveDownSibling()
- func (tv *TreeView) MoveToLastChild()
- func (tv *TreeView) MoveUp()
- func (n *TreeView) New() ki.Ki
- func (tv *TreeView) Open()
- func (tv *TreeView) ReRender2D() (node Node2D, layout bool)
- func (tv *TreeView) Render2D()
- func (tv *TreeView) RootTreeView() *TreeView
- func (tv *TreeView) RootUnselectAll()
- func (tv *TreeView) Select()
- func (tv *TreeView) SelectAction()
- func (tv *TreeView) SelectedSrcNodes() ki.Slice
- func (tv *TreeView) SelectedTreeViews() []*TreeView
- func (tv *TreeView) SetClosed()
- func (tv *TreeView) SetClosedState(closed bool)
- func (tv *TreeView) SetContinuousSelect()
- func (tv *TreeView) SetExtendSelect()
- func (tv *TreeView) SetSrcNode(sk ki.Ki)
- func (tv *TreeView) Size2D()
- func (tv *TreeView) SrcAddChild()
- func (tv *TreeView) SrcDelete()
- func (tv *TreeView) SrcDuplicate()
- func (tv *TreeView) SrcInsertAfter()
- func (tv *TreeView) SrcInsertBefore()
- func (tv *TreeView) Style2D()
- func (tv *TreeView) SyncToSrc()
- func (tv *TreeView) ToggleClose()
- func (tv *TreeView) Unselect()
- func (tv *TreeView) UnselectAll()
- type TreeViewSignals
- type TreeViewStates
- type TypeValueView
- type ValueView
- type ValueViewBase
- func (vv *ValueViewBase) AsValueViewBase() *ValueViewBase
- func (vv *ValueViewBase) ConfigWidget(widg Node2D)
- func (vv *ValueViewBase) CreateTempIfNotPtr() bool
- func (vv *ValueViewBase) IsInactive() bool
- func (n *ValueViewBase) New() ki.Ki
- func (vv *ValueViewBase) OwnerKind() reflect.Kind
- func (vv *ValueViewBase) SaveTmp()
- func (vv *ValueViewBase) SetMapKey(key reflect.Value, owner interface{}, tmpSave ValueView)
- func (vv *ValueViewBase) SetMapValue(val reflect.Value, owner interface{}, key interface{}, keyView ValueView, ...)
- func (vv *ValueViewBase) SetSliceValue(val reflect.Value, owner interface{}, idx int, tmpSave ValueView)
- func (vv *ValueViewBase) SetStructValue(val reflect.Value, owner interface{}, field *reflect.StructField, ...)
- func (vv *ValueViewBase) SetValue(val interface{}) bool
- func (vv *ValueViewBase) UpdateWidget()
- func (vv *ValueViewBase) Val() reflect.Value
- func (vv *ValueViewBase) ViewFieldTag(tagName string) string
- func (vv *ValueViewBase) WidgetType() reflect.Type
- type ValueViewer
- type Vec2D
- func (a Vec2D) Add(b Vec2D) Vec2D
- func (a Vec2D) AddVal(val float32) Vec2D
- func (a Vec2D) Dim(d Dims2D) float32
- func (a Vec2D) Distance(b Vec2D) float32
- func (a Vec2D) Div(b Vec2D) Vec2D
- func (a Vec2D) DivVal(val float32) Vec2D
- func (a Vec2D) Fixed() fixed.Point26_6
- func (a Vec2D) Interpolate(b Vec2D, t float32) Vec2D
- func (a Vec2D) IsZero() bool
- func (a Vec2D) Max(b Vec2D) Vec2D
- func (a Vec2D) Min(b Vec2D) Vec2D
- func (a Vec2D) MinPos(b Vec2D) Vec2D
- func (a Vec2D) Mul(b Vec2D) Vec2D
- func (a Vec2D) MulVal(val float32) Vec2D
- func (a *Vec2D) Set(x, y float32)
- func (a *Vec2D) SetAdd(b Vec2D)
- func (a *Vec2D) SetAddDim(d Dims2D, val float32)
- func (a *Vec2D) SetAddVal(val float32)
- func (a *Vec2D) SetDim(d Dims2D, val float32)
- func (a *Vec2D) SetDiv(b Vec2D)
- func (a *Vec2D) SetDivDim(d Dims2D, val float32)
- func (a *Vec2D) SetDivlVal(val float32)
- func (a *Vec2D) SetMax(b Vec2D)
- func (a *Vec2D) SetMaxDim(d Dims2D, val float32)
- func (a *Vec2D) SetMaxVal(val float32)
- func (a *Vec2D) SetMin(b Vec2D)
- func (a *Vec2D) SetMinDim(d Dims2D, val float32)
- func (a *Vec2D) SetMinPos(b Vec2D)
- func (a *Vec2D) SetMinPosDim(d Dims2D, val float32)
- func (a *Vec2D) SetMinPosVal(val float32)
- func (a *Vec2D) SetMinVal(val float32)
- func (a *Vec2D) SetMul(b Vec2D)
- func (a *Vec2D) SetMulDim(d Dims2D, val float32)
- func (a *Vec2D) SetMulVal(val float32)
- func (a *Vec2D) SetPoint(pt image.Point)
- func (a *Vec2D) SetSub(b Vec2D)
- func (a *Vec2D) SetSubDim(d Dims2D, val float32)
- func (a *Vec2D) SetSubVal(val float32)
- func (a *Vec2D) SetVal(val float32)
- func (a Vec2D) String() string
- func (a Vec2D) Sub(b Vec2D) Vec2D
- func (a Vec2D) SubVal(val float32) Vec2D
- func (a Vec2D) ToPoint() image.Point
- func (a Vec2D) ToPointCeil() image.Point
- func (a Vec2D) ToPointFloor() image.Point
- func (a Vec2D) ToPointRound() image.Point
- type ViewBox2D
- type ViewBoxAlign
- type ViewBoxMeetOrSlice
- type ViewBoxPreserveAspectRatio
- type Viewport2D
- func (vp *Viewport2D) AsViewport2D() *Viewport2D
- func (vp *Viewport2D) BBox2D() image.Rectangle
- func (g *Viewport2D) CSSProps() (css, agg *ki.Props)
- func (vp *Viewport2D) ChildrenBBox2D() image.Rectangle
- func (vp *Viewport2D) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)
- func (vp *Viewport2D) DeletePopup()
- func (vp *Viewport2D) DrawIntoParent(parVp *Viewport2D)
- func (vp *Viewport2D) DrawIntoWindow()
- func (vp *Viewport2D) DrawMainViewport()
- func (vp *Viewport2D) DrawMainVpOverMe()
- func (vp *Viewport2D) EncodePNG(w io.Writer) error
- func (vp *Viewport2D) FillViewport()
- func (g *Viewport2D) FocusChanged2D(gotFocus bool)
- func (vp *Viewport2D) Init2D()
- func (vp *Viewport2D) IsMenu() bool
- func (vp *Viewport2D) IsPopup() bool
- func (vp *Viewport2D) IsSVG() bool
- func (vp *Viewport2D) Layout2D(parBBox image.Rectangle)
- func (vp *Viewport2D) Move2D(delta image.Point, parBBox image.Rectangle)
- func (n *Viewport2D) New() ki.Ki
- func (vp *Viewport2D) PopBounds()
- func (vp *Viewport2D) PushBounds() bool
- func (vp *Viewport2D) ReRender2D() (node Node2D, layout 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(width, height int)
- func (vp *Viewport2D) SavePNG(path string) error
- func (vp *Viewport2D) SetCurWin()
- func (vp *Viewport2D) Size2D()
- func (vp *Viewport2D) Style2D()
- func (g *Viewport2D) StyleCSS(node Node2D)
- type Viewport2DFill
- type WalkStyleFieldFunc
- type WidgetBase
- func (g *WidgetBase) CSSProps() (css, agg *ki.Props)
- func (g *WidgetBase) ChildrenBBox2D() image.Rectangle
- func (g *WidgetBase) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)
- func (g *WidgetBase) ComputeBBox2DWidget(parBBox image.Rectangle, delta image.Point)
- func (g *WidgetBase) ConfigPartsIconLabel(icn *Icon, txt string) (config kit.TypeAndNameList, icIdx, lbIdx int)
- func (g *WidgetBase) ConfigPartsSetIconLabel(icn *Icon, txt string, icIdx, lbIdx int)
- func (g *WidgetBase) FocusChanged2D(gotFocus bool)
- func (g *WidgetBase) Init2D()
- func (g *WidgetBase) Init2DWidget()
- func (g *WidgetBase) Layout2D(parBBox image.Rectangle)
- func (g *WidgetBase) Layout2DParts(parBBox image.Rectangle)
- func (g *WidgetBase) Layout2DWidget(parBBox image.Rectangle)
- func (g *WidgetBase) MeasureTextSize(txt string) (w, h float32)
- func (g *WidgetBase) Move2D(delta image.Point, parBBox image.Rectangle)
- func (g *WidgetBase) Move2DWidget(delta image.Point, parBBox image.Rectangle)
- func (n *WidgetBase) New() ki.Ki
- func (g *WidgetBase) PartsNeedUpdateIconLabel(icn *Icon, txt string) bool
- func (g *WidgetBase) ReRender2D() (node Node2D, layout bool)
- func (g *WidgetBase) Render2DParts()
- func (g *WidgetBase) Render2DText(txt string)
- func (g *WidgetBase) RenderBoxImpl(pos Vec2D, sz Vec2D, rad float32)
- func (g *WidgetBase) RenderStdBox(st *Style)
- func (g *WidgetBase) Size2D()
- func (g *WidgetBase) Size2DAddSpace()
- func (g *WidgetBase) Size2DFromText(txt string)
- func (g *WidgetBase) Size2DFromWH(w, h float32)
- func (g *WidgetBase) Size2DWidget()
- func (g *WidgetBase) SizeFromParts()
- type Window
- func (w *Window) BenchmarkFullRender()
- func (w *Window) BenchmarkReRender()
- func (w *Window) ClearNonFocus()
- func (w *Window) ClosePopup(pop ki.Ki) bool
- func (w *Window) DeletePopupMenu(pop ki.Ki) bool
- func (w *Window) DisconnectNode(recv ki.Ki)
- func (w *Window) DisconnectPopup(pop ki.Ki)
- func (w *Window) EndCPUMemProfile()
- func (w *Window) EndTargProfile()
- func (w *Window) EventLoop()
- func (w *Window) FullReRender()
- func (w *Window) FullUpdate()
- func (w *Window) GenMouseFocusEvents(mev *mouse.MoveEvent)
- func (w *Window) IsInScope(gii Node2D, gi *Node2DBase) bool
- func (w *Window) LogicalDPI() float32
- func (n *Window) New() ki.Ki
- func (w *Window) PopFocus()
- func (w *Window) PopPopup(pop ki.Ki)
- func (w *Window) Publish()
- func (w *Window) PushFocus(p ki.Ki)
- func (w *Window) PushPopup(pop ki.Ki)
- func (w *Window) ReceiveEventType(recv ki.Ki, et oswin.EventType, fun ki.RecvFunc)
- func (w *Window) Resized(sz image.Point)
- func (w *Window) SendEventSignal(evi oswin.Event)
- func (w *Window) SetFocusItem(k ki.Ki) bool
- func (w *Window) SetNextFocusItem() bool
- func (w *Window) SetPrevFocusItem() bool
- func (w *Window) SetSize(sz image.Point)
- func (w *Window) StartCPUMemProfile()
- func (w *Window) StartEventLoop()
- func (w *Window) StartEventLoopNoWait()
- func (w *Window) StartTargProfile()
- func (w *Window) StopEventLoop()
- func (w *Window) UpdateFullVpRegion(vp *Viewport2D, vpBBox, winBBox image.Rectangle)
- func (w *Window) UpdateVpRegion(vp *Viewport2D, vpBBox, winBBox image.Rectangle)
- func (w *Window) UpdateVpRegionFromMain(winBBox image.Rectangle)
- func (w *Window) WinViewport2D() *Viewport2D
- func (w *Window) ZoomDPI(steps int)
- type XFormMatrix2D
- func (a XFormMatrix2D) Multiply(b XFormMatrix2D) XFormMatrix2D
- func (a XFormMatrix2D) Rotate(angle float32) XFormMatrix2D
- func (a XFormMatrix2D) Scale(x, y float32) XFormMatrix2D
- func (a XFormMatrix2D) Shear(x, y float32) XFormMatrix2D
- func (a XFormMatrix2D) TransformPoint(x, y float32) (tx, ty float32)
- func (a XFormMatrix2D) TransformPointToInt(x, y float32) (tx, ty int)
- func (a XFormMatrix2D) TransformVector(x, y float32) (tx, ty float32)
- func (a XFormMatrix2D) Translate(x, y float32) XFormMatrix2D
Constants ¶
This section is empty.
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{ "border-width": units.NewValue(0, units.Px), "border-radius": units.NewValue(0, units.Px), "border-color": &Prefs.BorderColor, "border-style": BorderSolid, "padding": units.NewValue(2, units.Px), "margin": units.NewValue(0, units.Px), "box-shadow.color": &Prefs.ShadowColor, "text-align": AlignCenter, "vertical-align": AlignTop, "background-color": &Prefs.ControlColor, "#icon": ki.Props{ "width": units.NewValue(1, units.Em), "height": units.NewValue(1, units.Em), "margin": units.NewValue(0, units.Px), "padding": units.NewValue(0, units.Px), "fill": &Prefs.IconColor, "stroke": &Prefs.FontColor, }, "#label": ki.Props{ "margin": units.NewValue(0, units.Px), "padding": units.NewValue(0, units.Px), }, "#indicator": ki.Props{ "width": units.NewValue(1.5, units.Ex), "height": units.NewValue(1.5, units.Ex), "margin": units.NewValue(0, units.Px), "padding": units.NewValue(0, units.Px), "vertical-align": AlignBottom, "fill": &Prefs.IconColor, "stroke": &Prefs.FontColor, }, ButtonSelectors[ButtonActive]: ki.Props{}, ButtonSelectors[ButtonInactive]: ki.Props{ "border-color": "lighter-50", "color": "lighter-50", }, ButtonSelectors[ButtonHover]: ki.Props{ "background-color": "darker-10", }, ButtonSelectors[ButtonFocus]: ki.Props{ "border-width": units.NewValue(2, units.Px), "background-color": "lighter-40", }, ButtonSelectors[ButtonDown]: ki.Props{ "color": "lighter-90", "background-color": "darker-30", }, ButtonSelectors[ButtonSelected]: ki.Props{ "background-color": &Prefs.SelectColor, }, }
var ButtonBaseFields = initButtonBase()
ButtonBaseFields contain the StyledFields for ButtonBase type
var ButtonBaseProps = ki.Props{ "base-type": true, }
var ButtonProps = ki.Props{ "border-width": units.NewValue(1, units.Px), "border-radius": units.NewValue(4, units.Px), "border-color": &Prefs.BorderColor, "border-style": BorderSolid, "padding": units.NewValue(4, units.Px), "margin": units.NewValue(4, units.Px), "box-shadow.h-offset": units.NewValue(4, units.Px), "box-shadow.v-offset": units.NewValue(4, units.Px), "box-shadow.blur": units.NewValue(4, units.Px), "box-shadow.color": &Prefs.ShadowColor, "text-align": AlignCenter, "vertical-align": AlignTop, "background-color": &Prefs.ControlColor, "#icon": ki.Props{ "width": units.NewValue(1, units.Em), "height": units.NewValue(1, units.Em), "margin": units.NewValue(0, units.Px), "padding": units.NewValue(0, units.Px), "fill": &Prefs.IconColor, "stroke": &Prefs.FontColor, }, "#label": ki.Props{ "margin": units.NewValue(0, units.Px), "padding": units.NewValue(0, units.Px), }, "#indicator": ki.Props{ "width": units.NewValue(1.5, units.Ex), "height": units.NewValue(1.5, units.Ex), "margin": units.NewValue(0, units.Px), "padding": units.NewValue(0, units.Px), "vertical-align": AlignBottom, "fill": &Prefs.IconColor, "stroke": &Prefs.FontColor, }, ButtonSelectors[ButtonActive]: ki.Props{}, ButtonSelectors[ButtonInactive]: ki.Props{ "border-color": "lighter-50", "color": "lighter-50", }, ButtonSelectors[ButtonHover]: ki.Props{ "background-color": "darker-10", }, ButtonSelectors[ButtonFocus]: ki.Props{ "border-width": units.NewValue(2, units.Px), "background-color": "lighter-40", }, ButtonSelectors[ButtonDown]: ki.Props{ "color": "lighter-90", "background-color": "darker-30", }, ButtonSelectors[ButtonSelected]: ki.Props{ "background-color": &Prefs.SelectColor, }, }
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{ "text-align": AlignLeft, "background-color": &Prefs.ControlColor, "#icon0": ki.Props{ "width": units.NewValue(1, units.Em), "height": units.NewValue(1, units.Em), "margin": units.NewValue(0, units.Px), "padding": units.NewValue(0, units.Px), "background-color": color.Transparent, "fill": &Prefs.ControlColor, "stroke": &Prefs.FontColor, }, "#icon1": ki.Props{ "width": units.NewValue(1, units.Em), "height": units.NewValue(1, units.Em), "margin": units.NewValue(0, units.Px), "padding": units.NewValue(0, units.Px), "background-color": color.Transparent, "fill": &Prefs.ControlColor, "stroke": &Prefs.FontColor, }, "#space": ki.Props{ "width": units.NewValue(1, units.Ex), }, "#label": ki.Props{ "margin": units.NewValue(0, units.Px), "padding": units.NewValue(0, units.Px), }, ButtonSelectors[ButtonActive]: ki.Props{}, ButtonSelectors[ButtonInactive]: ki.Props{ "border-color": "lighter-50", "color": "lighter-50", }, ButtonSelectors[ButtonHover]: ki.Props{ "background-color": "darker-10", }, ButtonSelectors[ButtonFocus]: ki.Props{ "border-width": units.NewValue(2, units.Px), "background-color": "lighter-20", }, ButtonSelectors[ButtonDown]: ki.Props{ "color": "lighter-90", "background-color": "darker-30", }, ButtonSelectors[ButtonSelected]: ki.Props{ "background-color": &Prefs.SelectColor, }, }
var ColorProps = ki.Props{ "style-prop": true, }
var ColorViewProps = ki.Props{ "background-color": &Prefs.BackgroundColor, "#title": ki.Props{ "max-width": units.NewValue(-1, units.Px), "text-align": AlignCenter, "vertical-align": AlignTop, }, }
var ComboBoxProps = ki.Props{ "border-width": units.NewValue(1, units.Px), "border-radius": units.NewValue(4, units.Px), "border-color": &Prefs.BorderColor, "border-style": BorderSolid, "padding": units.NewValue(4, units.Px), "margin": units.NewValue(4, units.Px), "text-align": AlignCenter, "vertical-align": AlignMiddle, "background-color": &Prefs.ControlColor, "#icon": ki.Props{ "width": units.NewValue(1, units.Em), "height": units.NewValue(1, units.Em), "margin": units.NewValue(0, units.Px), "padding": units.NewValue(0, units.Px), "fill": &Prefs.IconColor, "stroke": &Prefs.FontColor, }, "#label": ki.Props{ "margin": units.NewValue(0, units.Px), "padding": units.NewValue(0, units.Px), }, "#indicator": ki.Props{ "width": units.NewValue(1.5, units.Ex), "height": units.NewValue(1.5, units.Ex), "margin": units.NewValue(0, units.Px), "padding": units.NewValue(0, units.Px), "vertical-align": AlignBottom, "fill": &Prefs.IconColor, "stroke": &Prefs.FontColor, }, ButtonSelectors[ButtonActive]: ki.Props{}, ButtonSelectors[ButtonInactive]: ki.Props{ "border-color": "lighter-50", "color": "lighter-50", }, ButtonSelectors[ButtonHover]: ki.Props{ "background-color": "darker-10", }, ButtonSelectors[ButtonFocus]: ki.Props{ "border-width": units.NewValue(2, units.Px), "background-color": "lighter-20", }, ButtonSelectors[ButtonDown]: ki.Props{ "color": "lighter-90", "background-color": "darker-30", }, ButtonSelectors[ButtonSelected]: ki.Props{ "background-color": "darker-25", "color": "lighter-90", }, }
var DefaultKeyMap = KeyMap{ "UpArrow": KeyFunMoveUp, "Control+P": KeyFunMoveUp, "DownArrow": KeyFunMoveDown, "Control+N": KeyFunMoveDown, "RightArrow": KeyFunMoveRight, "Control+F": KeyFunMoveRight, "LeftArrow": KeyFunMoveLeft, "Control+B": KeyFunMoveLeft, "Control+UpArrow": KeyFunPageUp, "Control+U": KeyFunPageUp, "Control+DownArrow": KeyFunPageDown, "Control+V": KeyFunPageDown, "Control+RightArrow": KeyFunPageRight, "Control+LeftArrow": KeyFunPageLeft, "Home": KeyFunHome, "Control+A": KeyFunHome, "Meta+LeftArrow": KeyFunHome, "End": KeyFunEnd, "Control+E": KeyFunEnd, "Meta+RightArrow": KeyFunEnd, "Tab": KeyFunFocusNext, "Shift+Tab": KeyFunFocusPrev, "ReturnEnter": KeyFunSelectItem, "KeypadEnter": KeyFunSelectItem, "Control+ReturnEnter": KeyFunAccept, "Escape": KeyFunAbort, "Control+G": KeyFunCancelSelect, "Control+Spacebar": KeyFunSelectText, "DeleteBackspace": KeyFunBackspace, "DeleteForward": KeyFunDelete, "Control+D": KeyFunDelete, "Control+H": KeyFunBackspace, "Control+K": KeyFunKill, "Control+M": KeyFunDuplicate, "Control+I": KeyFunInsert, "Control+O": KeyFunInsertAfter, "Control+Alt+I": KeyFunGoGiEditor, "Control+Alt+E": KeyFunGoGiEditor, "Shift+Meta+=": KeyFunZoomIn, "Meta+=": KeyFunZoomIn, "Meta+-": KeyFunZoomOut, "Shift+Meta+-": KeyFunZoomOut, "Control+Alt+P": KeyFunPrefs, "F5": KeyFunRefresh, }
the default map has emacs-style navigation etc
var DialogProps = ki.Props{ "#frame": ki.Props{ "border-width": units.NewValue(2, units.Px), "margin": units.NewValue(8, units.Px), "padding": units.NewValue(4, units.Px), "box-shadow.h-offset": units.NewValue(4, units.Px), "box-shadow.v-offset": units.NewValue(4, units.Px), "box-shadow.blur": units.NewValue(4, units.Px), "box-shadow.color": "#CCC", }, "#title": ki.Props{ "max-width": units.NewValue(-1, units.Px), "text-align": AlignCenter, "vertical-align": AlignTop, "background-color": "none", }, "#prompt": ki.Props{ "max-width": units.NewValue(-1, units.Px), "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. This is also in gi.Prefs and updated from there
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 FrameProps = ki.Props{ "border-width": units.NewValue(2, units.Px), "border-radius": units.NewValue(0, units.Px), "border-color": &Prefs.BorderColor, "border-style": BorderSolid, "padding": units.NewValue(2, units.Px), "margin": units.NewValue(2, units.Px), "color": &Prefs.FontColor, "background-color": &Prefs.BackgroundColor, }
var IconProps = ki.Props{ "background-color": color.Transparent, }
var KiT_Action = kit.Types.AddType(&Action{}, ActionProps)
var KiT_Align = kit.Enums.AddEnumAltLower(AlignN, false, StylePropProps, "Align")
var KiT_BoolValueView = kit.Types.AddType(&BoolValueView{}, nil)
var KiT_BorderDrawStyle = kit.Enums.AddEnumAltLower(BorderN, false, StylePropProps, "Border")
var KiT_BoxSides = kit.Enums.AddEnumAltLower(BoxN, false, StylePropProps, "Box")
var KiT_Button = kit.Types.AddType(&Button{}, ButtonProps)
var KiT_ButtonBase = kit.Types.AddType(&ButtonBase{}, ButtonBaseProps)
var KiT_ButtonStates = kit.Enums.AddEnumAltLower(ButtonStatesN, false, StylePropProps, "Button")
var KiT_CheckBox = kit.Types.AddType(&CheckBox{}, CheckBoxProps)
var KiT_Circle = kit.Types.AddType(&Circle{}, nil)
var KiT_Color = kit.Types.AddType(&Color{}, ColorProps)
var KiT_ColorValueView = kit.Types.AddType(&ColorValueView{}, nil)
var KiT_ColorView = kit.Types.AddType(&ColorView{}, ColorViewProps)
var KiT_ComboBox = kit.Types.AddType(&ComboBox{}, ComboBoxProps)
var KiT_Dialog = kit.Types.AddType(&Dialog{}, DialogProps)
var KiT_Ellipse = kit.Types.AddType(&Ellipse{}, nil)
var KiT_EnumValueView = kit.Types.AddType(&EnumValueView{}, nil)
var KiT_FillRule = kit.Enums.AddEnumAltLower(FillRuleN, false, StylePropProps, "FillRule")
var KiT_FloatValueView = kit.Types.AddType(&FloatValueView{}, nil)
var KiT_FontStyles = kit.Enums.AddEnumAltLower(FontStylesN, false, StylePropProps, "Font")
var KiT_FontWeights = kit.Enums.AddEnumAltLower(FontWeightsN, false, StylePropProps, "Weight")
var KiT_Frame = kit.Types.AddType(&Frame{}, FrameProps)
var KiT_Icon = kit.Types.AddType(&Icon{}, IconProps)
var KiT_IconContexts = kit.Enums.AddEnum(IconContextsN, false, nil)
var KiT_IntValueView = kit.Types.AddType(&IntValueView{}, nil)
var KiT_KeyFunctions = kit.Enums.AddEnumAltLower(KeyFunctionsN, false, StylePropProps, "KeyFun")
var KiT_KiPtrValueView = kit.Types.AddType(&KiPtrValueView{}, nil)
var KiT_Label = kit.Types.AddType(&Label{}, LabelProps)
var KiT_Layout = kit.Types.AddType(&Layout{}, nil)
var KiT_Layouts = kit.Enums.AddEnumAltLower(LayoutsN, false, StylePropProps, "Layout")
var KiT_Line = kit.Types.AddType(&Line{}, nil)
var KiT_LineCap = kit.Enums.AddEnumAltLower(LineCapN, false, StylePropProps, "LineCap")
var KiT_LineJoin = kit.Enums.AddEnumAltLower(LineJoinN, false, StylePropProps, "LineJoin")
var KiT_MapInlineValueView = kit.Types.AddType(&MapInlineValueView{}, nil)
var KiT_MapValueView = kit.Types.AddType(&MapValueView{}, nil)
var KiT_MapView = kit.Types.AddType(&MapView{}, MapViewProps)
var KiT_MapViewInline = kit.Types.AddType(&MapViewInline{}, MapViewInlineProps)
var KiT_MenuButton = kit.Types.AddType(&MenuButton{}, MenuButtonProps)
var KiT_Node2DBase = kit.Types.AddType(&Node2DBase{}, Node2DBaseProps)
var KiT_Node3DBase = kit.Types.AddType(&Node3DBase{}, nil)
var KiT_NodeBase = kit.Types.AddType(&NodeBase{}, NodeBaseProps)
var KiT_NodeFlags = kit.Enums.AddEnum(NodeFlagsN, true, nil) // true = bitflags
var KiT_Overflow = kit.Enums.AddEnumAltLower(OverflowN, false, StylePropProps, "Overflow")
var KiT_PaintServers = kit.Enums.AddEnumAltLower(PaintServersN, false, StylePropProps, "Paint")
var KiT_Path = kit.Types.AddType(&Path{}, nil)
var KiT_Polygon = kit.Types.AddType(&Polygon{}, nil)
var KiT_Polyline = kit.Types.AddType(&Polyline{}, nil)
var KiT_Rect = kit.Types.AddType(&Rect{}, nil)
var KiT_RowCol = kit.Enums.AddEnumAltLower(RowColN, false, StylePropProps, "")
var KiT_SVG = kit.Types.AddType(&SVG{}, nil)
var KiT_ScrollBar = kit.Types.AddType(&ScrollBar{}, ScrollBarProps)
var KiT_Separator = kit.Types.AddType(&Separator{}, SeparatorProps)
var KiT_SliceValueView = kit.Types.AddType(&SliceValueView{}, nil)
var KiT_SliceView = kit.Types.AddType(&SliceView{}, SliceViewProps)
var KiT_SliceViewInline = kit.Types.AddType(&SliceViewInline{}, SliceViewInlineProps)
var KiT_Slider = kit.Types.AddType(&Slider{}, SliderProps)
var KiT_SliderBase = kit.Types.AddType(&SliderBase{}, SliderBaseProps)
var KiT_Space = kit.Types.AddType(&Space{}, SpaceProps)
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_StructInlineValueView = kit.Types.AddType(&StructInlineValueView{}, nil)
var KiT_StructValueView = kit.Types.AddType(&StructValueView{}, nil)
var KiT_StructView = kit.Types.AddType(&StructView{}, StructViewProps)
var KiT_StructViewInline = kit.Types.AddType(&StructViewInline{}, StructViewInlineProps)
var KiT_TabView = kit.Types.AddType(&TabView{}, nil)
var KiT_Text2D = kit.Types.AddType(&Text2D{}, nil)
var KiT_TextField = kit.Types.AddType(&TextField{}, TextFieldProps)
var KiT_TreeView = kit.Types.AddType(&TreeView{}, TreeViewProps)
var KiT_TypeValueView = kit.Types.AddType(&TypeValueView{}, nil)
var KiT_ValueViewBase = kit.Types.AddType(&ValueViewBase{}, ValueViewBaseProps)
var KiT_Viewport2D = kit.Types.AddType(&Viewport2D{}, Viewport2DProps)
var KiT_Viewport2DFill = kit.Types.AddType(&Viewport2DFill{}, nil)
var KiT_WidgetBase = kit.Types.AddType(&WidgetBase{}, WidgetBaseProps)
var KiT_Window = kit.Types.AddType(&Window{}, nil)
var LabelProps = ki.Props{ "padding": units.NewValue(2, units.Px), "margin": units.NewValue(2, units.Px), "vertical-align": AlignTop, "background-color": color.Transparent, }
var Layout2DTrace bool = false
set this variable to true to obtain a trace of all layouts (just printfs to stdout)
var MapViewProps = ki.Props{ "background-color": &Prefs.BackgroundColor, "#title": ki.Props{ "max-width": units.NewValue(-1, units.Px), "text-align": AlignCenter, "vertical-align": AlignTop, }, }
var MenuButtonProps = ki.Props{ "border-width": units.NewValue(1, units.Px), "border-radius": units.NewValue(4, units.Px), "border-color": &Prefs.BorderColor, "border-style": BorderSolid, "padding": units.NewValue(4, units.Px), "margin": units.NewValue(4, units.Px), "box-shadow.color": &Prefs.ShadowColor, "text-align": AlignCenter, "vertical-align": AlignMiddle, "background-color": &Prefs.ControlColor, "#icon": ki.Props{ "width": units.NewValue(1, units.Em), "height": units.NewValue(1, units.Em), "margin": units.NewValue(0, units.Px), "padding": units.NewValue(0, units.Px), "fill": &Prefs.IconColor, "stroke": &Prefs.FontColor, }, "#label": ki.Props{ "margin": units.NewValue(0, units.Px), "padding": units.NewValue(0, units.Px), }, "#indicator": ki.Props{ "width": units.NewValue(1.5, units.Ex), "height": units.NewValue(1.5, units.Ex), "margin": units.NewValue(0, units.Px), "padding": units.NewValue(0, units.Px), "vertical-align": AlignBottom, "fill": &Prefs.IconColor, "stroke": &Prefs.FontColor, }, ButtonSelectors[ButtonActive]: ki.Props{}, ButtonSelectors[ButtonInactive]: ki.Props{ "border-color": "lighter-50", "color": "lighter-50", }, ButtonSelectors[ButtonHover]: ki.Props{ "background-color": "darker-10", }, ButtonSelectors[ButtonFocus]: ki.Props{ "border-width": units.NewValue(2, units.Px), "background-color": "lighter-40", }, ButtonSelectors[ButtonDown]: ki.Props{ "color": "lighter-90", "background-color": "darker-30", }, ButtonSelectors[ButtonSelected]: ki.Props{ "background-color": &Prefs.SelectColor, }, }
var MenuFrameProps = ki.Props{ "border-width": units.NewValue(0, units.Px), "border-color": "none", "margin": units.NewValue(4, units.Px), "padding": units.NewValue(2, units.Px), "box-shadow.h-offset": units.NewValue(2, units.Px), "box-shadow.v-offset": units.NewValue(2, units.Px), "box-shadow.blur": units.NewValue(2, units.Px), "box-shadow.color": &Prefs.ShadowColor, }
var Node2DBaseProps = ki.Props{ "base-type": true, }
var NodeBaseProps = ki.Props{ "base-type": true, }
var PaintFields = initPaint()
PaintFields contain the StyledFields for Paint type
var Prefs = Preferences{}
Prefs are the overall preferences
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
set this variable to true to obtain a trace of the nodes rendering (just printfs to stdout)
var ScrollBarProps = ki.Props{ "border-width": units.NewValue(1, units.Px), "border-radius": units.NewValue(4, units.Px), "border-color": &Prefs.BorderColor, "border-style": BorderSolid, "padding": units.NewValue(0, units.Px), "margin": units.NewValue(2, units.Px), "background-color": &Prefs.ControlColor, SliderSelectors[SliderActive]: ki.Props{}, SliderSelectors[SliderInactive]: ki.Props{ "border-color": "lighter-50", "color": "lighter-50", }, SliderSelectors[SliderHover]: ki.Props{ "background-color": "darker-10", }, SliderSelectors[SliderFocus]: ki.Props{ "border-width": units.NewValue(2, units.Px), "background-color": "lighter-20", }, SliderSelectors[SliderDown]: ki.Props{ "background-color": "lighter-20", }, SliderSelectors[SliderValue]: ki.Props{ "border-color": &Prefs.IconColor, "background-color": &Prefs.IconColor, }, SliderSelectors[SliderBox]: ki.Props{ "border-color": &Prefs.BackgroundColor, "background-color": &Prefs.BackgroundColor, }, }
var SeparatorProps = ki.Props{ "padding": units.NewValue(2, units.Px), "margin": units.NewValue(2, units.Px), "align-vert": AlignCenter, "align-horiz": AlignCenter, "stroke-width": units.NewValue(2, units.Px), "color": &Prefs.FontColor, "stroke": &Prefs.FontColor, }
var SliceViewProps = ki.Props{ "background-color": &Prefs.BackgroundColor, "#title": ki.Props{ "max-width": units.NewValue(-1, units.Px), "text-align": AlignCenter, "vertical-align": AlignTop, }, }
var SliderBaseProps = ki.Props{ "base-type": true, }
var SliderFields = initSlider()
SliderFields contain the StyledFields for Slider type
var SliderProps = ki.Props{ "border-width": units.NewValue(1, units.Px), "border-radius": units.NewValue(4, units.Px), "border-color": &Prefs.BorderColor, "border-style": BorderSolid, "padding": units.NewValue(6, units.Px), "margin": units.NewValue(4, units.Px), "background-color": &Prefs.ControlColor, "#icon": ki.Props{ "width": units.NewValue(1, units.Em), "height": units.NewValue(1, units.Em), "margin": units.NewValue(0, units.Px), "padding": units.NewValue(0, units.Px), "fill": &Prefs.IconColor, "stroke": &Prefs.FontColor, }, SliderSelectors[SliderActive]: ki.Props{}, SliderSelectors[SliderInactive]: ki.Props{ "border-color": "lighter-50", "color": "lighter-50", }, SliderSelectors[SliderHover]: ki.Props{ "background-color": "darker-10", }, SliderSelectors[SliderFocus]: ki.Props{ "border-width": units.NewValue(2, units.Px), "background-color": "lighter-20", }, SliderSelectors[SliderDown]: ki.Props{ "background-color": "lighter-20", }, SliderSelectors[SliderValue]: ki.Props{ "border-color": &Prefs.IconColor, "background-color": &Prefs.IconColor, }, SliderSelectors[SliderBox]: ki.Props{ "border-color": &Prefs.BackgroundColor, "background-color": &Prefs.BackgroundColor, }, }
var SliderSelectors = []string{":active", ":inactive", ":hover", ":focus", ":down", ":value", ":box"}
Style selector names for the different states
var SpaceProps = ki.Props{ "width": units.NewValue(1, units.Em), "height": units.NewValue(1, units.Em), }
var SpinBoxProps = ki.Props{ "#buttons": ki.Props{ "vert-align": AlignMiddle, }, "#up": ki.Props{ "max-width": units.NewValue(1.5, units.Ex), "max-height": units.NewValue(1.5, units.Ex), "margin": units.NewValue(1, units.Px), "padding": units.NewValue(0, units.Px), "fill": &Prefs.IconColor, "stroke": &Prefs.FontColor, }, "#down": ki.Props{ "max-width": units.NewValue(1.5, units.Ex), "max-height": units.NewValue(1.5, units.Ex), "margin": units.NewValue(1, units.Px), "padding": units.NewValue(0, units.Px), "fill": &Prefs.IconColor, "stroke": &Prefs.FontColor, }, "#space": ki.Props{ "width": units.NewValue(.1, units.Ex), }, "#text-field": ki.Props{ "min-width": units.NewValue(4, units.Ex), "width": units.NewValue(8, units.Ex), "margin": units.NewValue(2, units.Px), "padding": units.NewValue(2, units.Px), }, }
var SplitViewProps = ki.Props{
"max-width": -1.0,
"max-height": -1.0,
"margin": 0,
"padding": 0,
}
auto-max-stretch
var SplitterProps = ki.Props{ "padding": units.NewValue(0, units.Px), "margin": units.NewValue(0, units.Px), "background-color": &Prefs.BackgroundColor, "#icon": ki.Props{ "max-width": units.NewValue(1, units.Em), "max-height": units.NewValue(5, units.Em), "min-width": units.NewValue(1, units.Em), "min-height": units.NewValue(5, units.Em), "margin": units.NewValue(0, units.Px), "padding": units.NewValue(0, units.Px), "vert-align": AlignMiddle, "fill": &Prefs.IconColor, "stroke": &Prefs.FontColor, }, SliderSelectors[SliderActive]: ki.Props{}, SliderSelectors[SliderInactive]: ki.Props{ "border-color": "lighter-50", "color": "lighter-50", }, SliderSelectors[SliderHover]: ki.Props{ "background-color": "darker-10", }, SliderSelectors[SliderFocus]: ki.Props{ "border-width": units.NewValue(2, units.Px), "background-color": "lighter-20", }, SliderSelectors[SliderDown]: ki.Props{}, SliderSelectors[SliderValue]: ki.Props{ "border-color": &Prefs.IconColor, "background-color": &Prefs.IconColor, }, SliderSelectors[SliderBox]: ki.Props{ "border-color": &Prefs.BackgroundColor, "background-color": &Prefs.BackgroundColor, }, }
var StdDialogVSpace = float32(2.0)
standard vertical space between elements in a dialog, in Em units
var StdDialogVSpaceUnits = units.Value{StdDialogVSpace, units.Em, 0}
var StdIconNames = [IconContextsN][]string{
{
"widget-wedge-down",
"widget-wedge-up",
"widget-wedge-left",
"widget-wedge-right",
"widget-checkmark",
"widget-checked-box",
"widget-unchecked-box",
"widget-circlebutton-on",
"widget-circlebutton-off",
"widget-handle-circles",
}, {
"edit-clear",
"edit-copy",
"edit-cut",
"edit-delete",
"edit-find",
"edit-find-replace",
"edit-paste",
"edit-redo",
"edit-select-all",
"edit-undo",
"list-add",
"list-remove",
}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
}
list of standard icon names that we expect to find in an IconSet
var StretchProps = ki.Props{
"max-width": -1.0,
"max-height": -1.0,
}
var StructViewProps = ki.Props{ "background-color": &Prefs.BackgroundColor, "#title": ki.Props{ "max-width": units.NewValue(-1, units.Px), "text-align": AlignCenter, "vertical-align": AlignTop, }, }
var StyleFields = initStyle()
StyleFields contain the StyledFields for Style type
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 TVBranchProps = ki.Props{ "fill": &Prefs.IconColor, "stroke": &Prefs.FontColor, }
var TabButtonProps = ki.Props{ "border-width": units.NewValue(1, units.Px), "border-radius": units.NewValue(0, units.Px), "border-color": &Prefs.BorderColor, "border-style": BorderSolid, "padding": units.NewValue(4, units.Px), "margin": units.NewValue(0, units.Px), "background-color": &Prefs.ControlColor, "box-shadow.h-offset": units.NewValue(0, units.Px), "box-shadow.v-offset": units.NewValue(0, units.Px), "box-shadow.blur": units.NewValue(0, units.Px), "box-shadow.color": &Prefs.ShadowColor, "text-align": AlignCenter, }
var TextFieldProps = ki.Props{ "border-width": units.NewValue(1, units.Px), "border-color": &Prefs.BorderColor, "border-style": BorderSolid, "padding": units.NewValue(4, units.Px), "margin": units.NewValue(1, units.Px), "text-align": AlignLeft, "vertical-align": AlignTop, "background-color": &Prefs.ControlColor, TextFieldSelectors[TextFieldActive]: ki.Props{}, TextFieldSelectors[TextFieldFocus]: ki.Props{ "border-width": units.NewValue(2, units.Px), "background-color": "lighter-80", }, TextFieldSelectors[TextFieldInactive]: ki.Props{ "background-color": "darker-20", }, }
var TextFieldSelectors = []string{":active", ":focus", ":inactive"}
Style selector names for the different states
var TreeViewFields = initTreeView()
TreeViewFields contain the StyledFields for TreeView type
var TreeViewProps = ki.Props{ "indent": units.NewValue(2, units.Ch), "border-width": units.NewValue(0, units.Px), "border-radius": units.NewValue(0, units.Px), "padding": units.NewValue(1, units.Px), "margin": units.NewValue(1, units.Px), "text-align": AlignLeft, "vertical-align": AlignTop, "background-color": "inherit", "#branch": ki.Props{ "vertical-align": AlignMiddle, "margin": units.NewValue(0, units.Px), "padding": units.NewValue(0, units.Px), "background-color": color.Transparent, "max-width": units.NewValue(.8, units.Em), "max-height": units.NewValue(.8, units.Em), }, "#space": ki.Props{ "width": units.NewValue(.5, units.Em), }, "#label": ki.Props{ "margin": units.NewValue(0, units.Px), "padding": units.NewValue(0, units.Px), "min-width": units.NewValue(16, units.Ex), }, "#menu": ki.Props{ "indicator": "none", }, TreeViewSelectors[TreeViewActive]: ki.Props{ "background-color": "inherit", }, TreeViewSelectors[TreeViewSel]: ki.Props{ "background-color": &Prefs.SelectColor, }, TreeViewSelectors[TreeViewFocus]: ki.Props{ "background-color": &Prefs.ControlColor, }, }
var TreeViewSelectors = []string{":active", ":selected", ":focus"}
Style selector names for the different states:
var Update2DTrace bool = false
set this variable to true to obtain a trace of updates that trigger re-rendering
var ValueViewBaseProps = ki.Props{ "base-type": true, }
var Vec2DZero = Vec2D{0, 0}
var Viewport2DProps = ki.Props{ "background-color": &Prefs.BackgroundColor, }
var WidgetBaseProps = ki.Props{ "base-type": true, }
Functions ¶
func ApplyCSS ¶
ApplyCSS applies css styles to given node, using key to select sub-props from overall properties list
func FixedToFloat32 ¶
func Float32ToFixed ¶
func Float32ToFixedPoint ¶
func FloatMod32 ¶
FloatMod ensures that a floating point value is an even multiple of a given value
func GoGiEditorOf ¶
open an interactive editor of the given Ki tree, at its root
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 InRangeInt ¶
InRangeInt returns the value constrained to the min / max range
func Init2DButtonEvents ¶
func Init2DButtonEvents(bw ButtonWidget)
handles all the basic button events
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)
convert Ki to a Node2D interface and a Node2DBase obj -- nil if not
func MeasureChars ¶
MeasureChars returns inter-character points for each char, in float32
func NewKiDialogValues ¶
get the user-set values from a NewKiDialog
func PathDataRender ¶
func PathDataRender(data []PathData, pc *Paint, rs *RenderState)
PathDataRender traverses the path data and renders it using paint and render state -- we assume all the data has been validated and that n's are sufficient, etc
func PopupIsMenu ¶
PopupIsMenu returns true if the given popup item is a menu
func PromptDialog ¶
func PromptDialog(avp *Viewport2D, title, prompt string, ok, cancel bool, recv ki.Ki, fun ki.RecvFunc)
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)
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 RectFromPosSize ¶
RectFromPosSize returns an image.Rectangle from max dims of pos, size (floor on pos, ceil on size)
func SetButtonIcon ¶
func SetButtonIcon(bw ButtonWidget, ic *Icon)
set the Icon (could be nil) and update button
func SignalViewport2D ¶
each node calls this signal method to notify its parent viewport whenever it changes, causing a re-render
func SignalWindowFlush ¶
func SrcNodeSignal ¶
function for receiving node signals from our SrcNode
func StringPromptDialogValue ¶
StringPromptValue gets the string value the user set
func StyleCSSWidget ¶
func StyleEffTag ¶
get the full effective tag based on outer tag plus given tag
func StyleUnitsValue ¶
manual method for getting a units value directly
func TabButtonClicked ¶
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 Truncate ¶
Truncate a floating point number to given level of precision -- slow.. uses string conversion
func Truncate32 ¶
Truncate a floating point number to given level of precision -- slow.. uses string conversion
func WalkStyleStruct ¶
func WalkStyleStruct(obj interface{}, outerTag string, baseoff uintptr, fun WalkStyleFieldFunc)
WalkStyleStruct walks through a struct, calling a function on fields with xml tags that are not "-", recursively through all the fields
Types ¶
type Action ¶
type Action struct { ButtonBase Data interface{} `json:"-" xml:"-" desc:"optional data that is sent with the ActionSig when it is emitted"` ActionSig ki.Signal `` /* 148-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 and toolbars
func (*Action) ButtonAsBase ¶
func (g *Action) ButtonAsBase() *ButtonBase
func (*Action) ConfigParts ¶
func (g *Action) ConfigParts()
func (*Action) ConfigPartsButton ¶
func (g *Action) ConfigPartsButton()
func (*Action) ConfigPartsMenu ¶
func (g *Action) ConfigPartsMenu()
type Align ¶
type Align int32
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 BackgroundStyle ¶
type BackgroundStyle struct {
Color Color `xml:"color" desc:"background color"`
}
style parameters for backgrounds
func (*BackgroundStyle) Defaults ¶
func (b *BackgroundStyle) Defaults()
type BoolValueView ¶
type BoolValueView struct {
ValueViewBase
}
BoolValueView presents a checkbox for a boolean
func (*BoolValueView) ConfigWidget ¶
func (vv *BoolValueView) ConfigWidget(widg Node2D)
func (*BoolValueView) New ¶
func (n *BoolValueView) New() ki.Ki
func (*BoolValueView) UpdateWidget ¶
func (vv *BoolValueView) UpdateWidget()
func (*BoolValueView) WidgetType ¶
func (vv *BoolValueView) WidgetType() reflect.Type
type BorderDrawStyle ¶
type BorderDrawStyle int32
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:"how to draw the border"` Width units.Value `xml:"width" desc:"width of the border"` Radius units.Value `xml:"radius" desc:"rounding of the corners"` Color Color `xml:"color" desc:"color of the border"` }
style parameters for borders
type BoxSides ¶
type BoxSides int32
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 (*Button) ButtonAsBase ¶
func (g *Button) ButtonAsBase() *ButtonBase
type ButtonBase ¶
type ButtonBase struct { WidgetBase Text string `xml:"text" desc:"label for the button -- if blank then no label is presented"` Icon *Icon `` /* 151-byte string literal not displayed */ Indicator string `` /* 157-byte string literal not displayed */ Shortcut string `xml:"shortcut" desc:"keyboard shortcut -- todo: need to figure out ctrl, alt etc"` StateStyles [ButtonStatesN]Style `` /* 237-byte string literal not displayed */ State ButtonStates `json:"-" xml:"-" desc:"current state of the button based on gui interaction"` ButtonSig ki.Signal `json:"-" xml:"-" desc:"signal for button -- see ButtonSignals for the types"` Menu ki.Slice `desc:"the menu items for this menu -- typically add Action elements for menus, along with separators"` MakeMenuFunc MakeMenuFunc `json:"-" xml:"-" desc:"set this to make a menu on demand -- if set then this button acts like a menu button"` }
ButtonBase has common button functionality for all buttons, including Button, Action, MenuButton, CheckBox, etc
var ButtonBaseDefault ButtonBase
ButtonBaseDefault is default obj that can be used when property specifies "default"
func (*ButtonBase) AddMenuText ¶
func (g *ButtonBase) AddMenuText(txt string, sigTo ki.Ki, data interface{}, fun ki.RecvFunc) *Action
AddMenuText adds an action to the menu with a text label -- todo: shortcuts
func (*ButtonBase) AddSeparator ¶
func (g *ButtonBase) AddSeparator(name string) *Separator
AddSeparator adds a separator at the next point in the menu
func (*ButtonBase) ButtonAsBase ¶
func (g *ButtonBase) ButtonAsBase() *ButtonBase
func (*ButtonBase) ButtonEnterHover ¶
func (g *ButtonBase) ButtonEnterHover()
button starting hover-- todo: keep track of time and popup a tooltip -- signal?
func (*ButtonBase) ButtonPressed ¶
func (g *ButtonBase) ButtonPressed()
set the button in the down state -- mouse clicked down but not yet up -- emits ButtonPressed signal -- ButtonClicked is down and up
func (*ButtonBase) ButtonRelease ¶
func (g *ButtonBase) ButtonRelease()
func (*ButtonBase) ButtonReleased ¶
func (g *ButtonBase) ButtonReleased()
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) ConfigParts ¶
func (g *ButtonBase) ConfigParts()
func (*ButtonBase) ConfigPartsAddIndicator ¶
func (g *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 "indic-stretch" is added as well to put on the right by default
func (*ButtonBase) ConfigPartsIfNeeded ¶
func (g *ButtonBase) ConfigPartsIfNeeded()
func (*ButtonBase) ConfigPartsIndicator ¶
func (g *ButtonBase) ConfigPartsIndicator(indIdx int)
func (*ButtonBase) FocusChanged2D ¶
func (g *ButtonBase) FocusChanged2D(gotFocus bool)
func (*ButtonBase) HasMenu ¶
func (g *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) Init2D ¶
func (g *ButtonBase) Init2D()
func (*ButtonBase) IsMenu ¶
func (g *ButtonBase) IsMenu() bool
IsMenu returns true this button is on a menu -- it is a menu item
func (*ButtonBase) Layout2D ¶
func (g *ButtonBase) Layout2D(parBBox image.Rectangle)
func (*ButtonBase) New ¶
func (n *ButtonBase) New() ki.Ki
func (*ButtonBase) OpenMenu ¶
func (g *ButtonBase) OpenMenu() bool
OpenMenu will open any menu associated with this element -- returns true if menu opened, false if not
func (*ButtonBase) Render2D ¶
func (g *ButtonBase) Render2D()
func (*ButtonBase) Render2DDefaultStyle ¶
func (g *ButtonBase) Render2DDefaultStyle()
func (*ButtonBase) ResetMenu ¶
func (g *ButtonBase) ResetMenu()
ResetMenu removes all items in the menu
func (*ButtonBase) SetAsButton ¶
func (g *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 (g *ButtonBase) SetAsMenu()
SetAsMenu ensures that this functions as a menu even before menu items are added
func (*ButtonBase) SetButtonState ¶
func (g *ButtonBase) SetButtonState(state ButtonStates)
set the button state to target
func (*ButtonBase) SetCheckable ¶
func (g *ButtonBase) SetCheckable(checkable bool)
SetCheckable sets whether this button is checkable -- emits ButtonToggled signals if so
func (*ButtonBase) SetChecked ¶
func (g *ButtonBase) SetChecked(chk bool)
set the checked state of this button -- does not emit signal or update
func (*ButtonBase) SetIcon ¶
func (g *ButtonBase) SetIcon(ic *Icon)
SetIcon sets the Icon (could be nil) and updates the button
func (*ButtonBase) SetSelected ¶
func (g *ButtonBase) SetSelected(sel bool)
set the selected state of this button -- does not emit signal or update
func (*ButtonBase) SetText ¶
func (g *ButtonBase) SetText(txt string)
SetText sets the text and updates the button
func (*ButtonBase) Style2D ¶
func (g *ButtonBase) Style2D()
func (*ButtonBase) Style2DWidget ¶
func (g *ButtonBase) Style2DWidget()
func (*ButtonBase) ToggleChecked ¶
func (g *ButtonBase) ToggleChecked()
ToggleChecked toggles the checked state of this button -- does not emit signal or update
type ButtonSignals ¶
type ButtonSignals int64
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 mose 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 -- maintains selected state 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 { // get the button base for most basic functions -- reduces interface size ButtonAsBase() *ButtonBase // called for release of button -- this is where buttons actually differ in functionality ButtonRelease() // configure the parts of the button -- called during init and style ConfigParts() // configure 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 *Icon `json:"-" xml:"-" desc:"icon to use for the off, unchecked state of the icon -- plain Icon holds the On state"` }
CheckBox toggles between a checked and unchecked state
func (*CheckBox) ButtonAsBase ¶
func (g *CheckBox) ButtonAsBase() *ButtonBase
func (*CheckBox) ButtonRelease ¶
func (g *CheckBox) ButtonRelease()
func (*CheckBox) ConfigParts ¶
func (g *CheckBox) ConfigParts()
func (*CheckBox) ConfigPartsIfNeeded ¶
func (g *CheckBox) ConfigPartsIfNeeded()
type Circle ¶
type Circle struct { Node2DBase Pos Vec2D `xml:"{cx,cy}" desc:"position of the center of the circle"` Radius float32 `xml:"r" desc:"radius of the circle"` }
2D circle
func (*Circle) ReRender2D ¶
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 ColorFromString ¶
ColorFromString returns a new color set from given string and optional base color for transforms -- see SetString
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) IsNil ¶
check 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) 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) SetFloat32 ¶
Convert from 0-1 normalized floating point numbers
func (*Color) SetFloat64 ¶
Convert from 0-1 normalized floating point numbers
func (*Color) SetHSL ¶
Convert from HSL: [0..360], Saturation [0..1], and Luminance (lightness) [0..1] of the color using float32 values
func (*Color) SetHSLA ¶
Convert from HSLA: [0..360], Saturation [0..1], and Luminance (lightness) [0..1] of the color using float32 values
func (*Color) SetNPFloat32 ¶
Convert from 0-1 normalized floating point numbers, non alpha-premultiplied
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) ToFloat32 ¶
Convert to 0-1 normalized floating point numbers, still alpha-premultiplied
func (*Color) ToHSLA ¶
Convert to HSLA: [0..360], Saturation [0..1], and Luminance (lightness) [0..1] of the color using float32 values
func (Color) ToNPFloat32 ¶
Convert to 0-1 normalized floating point numbers, not alpha premultiplied
type ColorValueView ¶
type ColorValueView struct {
ValueViewBase
}
ColorValueView presents a StructViewInline for a struct plus a ColorView button..
func (*ColorValueView) ConfigWidget ¶
func (vv *ColorValueView) ConfigWidget(widg Node2D)
func (*ColorValueView) New ¶
func (n *ColorValueView) New() ki.Ki
func (*ColorValueView) UpdateWidget ¶
func (vv *ColorValueView) UpdateWidget()
func (*ColorValueView) WidgetType ¶
func (vv *ColorValueView) WidgetType() reflect.Type
type ColorView ¶
type ColorView struct { Frame Color *Color `desc:"the color that we view"` Title string `desc:"title / prompt to show above the editor fields"` TmpSave ValueView `` /* 189-byte string literal not displayed */ ViewSig ki.Signal `` /* 179-byte string literal not displayed */ }
ColorView represents a color, using sliders to set values
func (*ColorView) ButtonBox ¶
ButtonBox returns the ButtonBox layout widget, and its index, within frame -- nil, -1 if not found
func (*ColorView) Config ¶
func (sv *ColorView) Config()
Config configures a standard setup of entire view
func (*ColorView) ConfigHSLSlider ¶
func (*ColorView) ConfigLabel ¶
func (*ColorView) ConfigRGBSlider ¶
func (*ColorView) ConfigSliderGrid ¶
func (sv *ColorView) ConfigSliderGrid()
ConfigSliderGrid configures the SliderGrid
func (*ColorView) ReRender2D ¶
func (*ColorView) SetHSLValue ¶
func (*ColorView) SetRGBValue ¶
func (*ColorView) SliderGrid ¶
func (*ColorView) StdFrameConfig ¶
func (sv *ColorView) StdFrameConfig() kit.TypeAndNameList
StdFrameConfig returns a TypeAndNameList for configuring a standard Frame -- can modify as desired before calling ConfigChildren on Frame using this
func (*ColorView) StdSliderConfig ¶
func (sv *ColorView) StdSliderConfig() kit.TypeAndNameList
StdSliderConfig returns a TypeAndNameList for configuring a standard sliders
func (*ColorView) StdValueLayConfig ¶
func (sv *ColorView) StdValueLayConfig() kit.TypeAndNameList
func (*ColorView) TitleWidget ¶
Title returns the title label widget, and its index, within frame -- nil, -1 if not found
func (*ColorView) UpdateHSLSlider ¶
func (*ColorView) UpdateRGBSlider ¶
func (*ColorView) UpdateSliderGrid ¶
func (sv *ColorView) UpdateSliderGrid()
func (*ColorView) ValueLayConfig ¶
func (sv *ColorView) ValueLayConfig()
type ComboBox ¶
type ComboBox struct { ButtonBase Editable bool `desc:"provide a text field for editing the value, or just a button for selecting items?"` 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 ki.Slice `json:"-" xml:"-" desc:"the menu of actions for selecting items -- automatically generated from Items"` ComboSig ki.Signal `` /* 160-byte string literal not displayed */ MaxLength int `desc:"maximum label length (in runes)"` }
func (*ComboBox) ButtonAsBase ¶
func (g *ComboBox) ButtonAsBase() *ButtonBase
func (*ComboBox) ButtonRelease ¶
func (g *ComboBox) ButtonRelease()
func (*ComboBox) ConfigParts ¶
func (g *ComboBox) ConfigParts()
func (*ComboBox) ConfigPartsIfNeeded ¶
func (g *ComboBox) ConfigPartsIfNeeded()
func (*ComboBox) FocusChanged2D ¶
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) 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) Render2DDefaultStyle ¶
func (g *ComboBox) Render2DDefaultStyle()
render using a default style if not otherwise styled
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) SetText ¶
set the text and update button -- does NOT change the currently-selected value or index
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 Dialog ¶
type Dialog struct { Viewport2D Title string `desc:"title text displayed at the top row of 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"` State DialogState `desc:"state of the dialog"` DialogSig ki.Signal `json:"-" xml:"-" desc:"signal for dialog -- sends a signal when opened, accepted, or canceled"` }
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 ColorViewDialog ¶
func ColorViewDialog(avp *Viewport2D, clr *Color, tmpSave ValueView, title, prompt string, recv ki.Ki, fun ki.RecvFunc) *Dialog
ColorViewDialog for editing a color using a ColorView -- optionally connects to given signal receiving object and function for dialog signals (nil to ignore)
func MapViewDialog ¶
func MapViewDialog(avp *Viewport2D, mp interface{}, tmpSave ValueView, title, prompt string, recv ki.Ki, fun ki.RecvFunc) *Dialog
MapViewDialog is for editing elements of a map using a MapView -- optionally connects to given signal receiving object and function for dialog signals (nil to ignore)
func NewKiDialog ¶
func NewKiDialog(avp *Viewport2D, iface reflect.Type, title, prompt string, recv ki.Ki, fun ki.RecvFunc) *Dialog
New Ki item(s) of type dialog, showing types that implement given interface -- use construct of form: reflect.TypeOf((*gi.Node2D)(nil)).Elem() to get the interface type -- optionally connects to given signal receiving object and function for dialog signals (nil to ignore)
func NewStdDialog ¶
NewStdDialog returns a basic standard dialog with a name, title, prompt, and ok / cancel buttons -- any empty text will not be added -- returns with UpdateStart started but NOT ended -- must call UpdateEnd(true) once done configuring!
func SliceViewDialog ¶
func SliceViewDialog(avp *Viewport2D, mp interface{}, tmpSave ValueView, title, prompt string, recv ki.Ki, fun ki.RecvFunc) *Dialog
SliceViewDialog for editing elements of a slice using a SliceView -- optionally connects to given signal receiving object and function for dialog signals (nil to ignore)
func StringPromptDialog ¶
func StringPromptDialog(avp *Viewport2D, strval, title, prompt string, 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)
func StructViewDialog ¶
func StructViewDialog(avp *Viewport2D, stru interface{}, tmpSave ValueView, title, prompt string, recv ki.Ki, fun ki.RecvFunc) *Dialog
StructViewDialog is for editing fields of a structure using a StructView -- optionally connects to given signal receiving object and function for dialog signals (nil to ignore)
func (*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 optional fixed space and stretch elements before 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) 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) bool
Open this dialog, in given location (0 = middle of window), finding window from given viewport -- returns false if it fails for any reason
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, with the given amount of space before it, sized in "Em"'s (units of font size), if > 0
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 ¶
StdButtonConnnect connects standard buttons in given button box layout to Accept / Cancel actions
type DialogState ¶
type DialogState int64
state of the dialog
const ( // existential state -- struct exists and is likely being constructed DialogExists DialogState = iota // dialog is open in a modal state, blocking all other input DialogOpenModal // dialog is open in a modeless state, allowing other input DialogOpenModeless // Ok was pressed -- dialog accepted DialogAccepted // 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 Dims2D ¶
type Dims2D int32
dimensions
func (*Dims2D) FromString ¶
func (Dims2D) MarshalJSON ¶
func (*Dims2D) UnmarshalJSON ¶
type Ellipse ¶
type Ellipse struct { Node2DBase Pos Vec2D `xml:"{cx,cy}" desc:"position of the center of the ellipse"` Radii Vec2D `xml:"{rx, ry}" desc:"radii of the ellipse in the horizontal, vertical axes"` }
2D ellipse
func (*Ellipse) ReRender2D ¶
type EnumValueView ¶
type EnumValueView struct {
ValueViewBase
}
EnumValueView presents a combobox for choosing enums
func (*EnumValueView) ConfigWidget ¶
func (vv *EnumValueView) ConfigWidget(widg Node2D)
func (*EnumValueView) EnumType ¶
func (vv *EnumValueView) EnumType() reflect.Type
func (*EnumValueView) New ¶
func (n *EnumValueView) New() ki.Ki
func (*EnumValueView) SetEnumValueFromInt ¶
func (vv *EnumValueView) SetEnumValueFromInt(ival int64) bool
func (*EnumValueView) UpdateWidget ¶
func (vv *EnumValueView) UpdateWidget()
func (*EnumValueView) WidgetType ¶
func (vv *EnumValueView) WidgetType() reflect.Type
type FieldValueViewer ¶
FieldValueViewer interface supplies the appropriate type of ValueView for a given field name and current field value on the receiver parent struct -- called on a given receiver struct if defined for that receiver type (tries both pointer and non-pointer receivers) -- if a struct implements this interface, then it is used first for structs -- return nil to fall back on the default ToValueView result
type FillRule ¶
type FillRule int
func (*FillRule) FromString ¶
func (FillRule) MarshalJSON ¶
func (*FillRule) UnmarshalJSON ¶
type FillStyle ¶
type FillStyle struct { On bool `desc:"is fill active -- if property is none then false"` Color Color `xml:"fill" desc:"default fill color when such a color is needed -- Server could be anything"` Opacity float64 `xml:"fill-opacity" desc:"global alpha opacity / transparency factor"` Server PaintServer `view:"-" desc:"paint server for the fill -- if solid color, defines fill color"` Rule FillRule `xml:"fill-rule" desc:"rule for how to fill more complex shapes with crossing lines"` }
FillStyle contains all the properties specific to filling a region
func (*FillStyle) Defaults ¶
func (pf *FillStyle) Defaults()
initialize default values for paint fill
func (*FillStyle) SetStylePost ¶
func (pf *FillStyle) SetStylePost()
need to do some updating after setting the style from user properties
type FloatValueView ¶
type FloatValueView struct {
ValueViewBase
}
FloatValueView presents a spinbox
func (*FloatValueView) ConfigWidget ¶
func (vv *FloatValueView) ConfigWidget(widg Node2D)
func (*FloatValueView) New ¶
func (n *FloatValueView) New() ki.Ki
func (*FloatValueView) UpdateWidget ¶
func (vv *FloatValueView) UpdateWidget()
func (*FloatValueView) WidgetType ¶
func (vv *FloatValueView) WidgetType() reflect.Type
type FontLib ¶
type FontLib struct { FontPaths []string FontsAvail map[string]string `desc:"map of font name to path to file"` Faces map[string]map[float64]font.Face // contains filtered or unexported fields }
var FontLibrary FontLib
we export this font library
func (*FontLib) AddFontPaths ¶
func (*FontLib) InitFontPaths ¶
InitFontPaths initializes font paths to system defaults, only if no paths have yet been set
func (*FontLib) UpdateFontsAvail ¶
type FontStyle ¶
type FontStyle struct { Face font.Face `desc:"actual font codes for drawing text -- just a pointer into FontLibrary of loaded fonts"` Height float32 `desc:"recommended line hieight of font in dots"` FaceName string `desc:"name corresponding to Face"` Size units.Value `xml:"size" desc:"size of font to render -- convert to points when getting font to use"` Family string `` /* 140-byte string literal not displayed */ Style FontStyles `xml:"style" inherit:"true","desc:"style -- normal, italic, etc"` Weight FontWeights `xml:"weight" inherit:"true","desc:"weight: normal, bold, etc"` }
font style information -- used in Paint and in Style -- see style.go
func (*FontStyle) SetStylePost ¶
func (p *FontStyle) SetStylePost()
any updates after generic xml-tag property setting?
func (*FontStyle) SetUnitContext ¶
type FontStyles ¶
type FontStyles int32
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 FontWeights ¶
type FontWeights int32
styles of font: normal, italic, etc
const ( WeightNormal FontWeights = iota WeightBold WeightBolder WeightLighter // Weight100...900 todo: seriously? 400 = normal, 700 = bold 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
}
Frame is a basic container for widgets -- a layout that renders the standard box model
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 Icon ¶
type Icon struct { SVG Rendered bool `` /* 160-byte string literal not displayed */ RenderedSize image.Point `json:"-" xml:"-" desc:"size at which we previously rendered"` }
Icon is an SVG that is assumed to 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 can be cached for a given set of fill / stroke paint values, as an optimization.
func IconByName ¶
IconByName is main function to get icon by name -- looks in CurIconSet and falls back to DefaultIconSet if not found there -- logs a message and returns nil if not found
func IconListSorted ¶
IconListSorted returns a slice of all the icons in the icon set sorted by name
func (*Icon) CopyFromIcon ¶
copy from a source icon, typically one from a library -- preserves all the exisiting render state etc for the current icon, so that only a new render is required
func (*Icon) SetNormXForm ¶
func (vp *Icon) SetNormXForm()
set a normalized 0-1 scaling transform so svg's use 0-1 coordinates that map to actual size of the viewport -- used e.g. for Icon
type IconContexts ¶
type IconContexts int32
different types of standard icon name spaces, from https://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html -- we organize our IconSets into these different contexts
const ( // Icons that are used as parts of standard widgets -- these are available built-in WidgetIcons IconContexts = iota // Icons which are generally used in menus and dialogs for interacting with the user. ActionIcons // Animated images used to represent loading web sites, or other background processing which may be less suited to more verbose progress reporting in the user interface. AnimationIcons // Icons that describe what an application is, for use in the Programs menu, window decorations, and the task list. These may or may not be generic depending on the application and its purpose. ApplicationIcons // Icons that are used for categories in the Programs menu, or the Control Center, for separating applications, preferences, and settings for display to the user. CategoryIcons // Icons for hardware that is contained within or connected to the computing device. Naming for extended devices in this group, is of the form <primary function>-<manufacturer>-<model>. This allows ease of fallback to the primary function device name, or ones more targeted for a specific series of models from a manufacturer. DeviceIcons // Icons for tags and properties of files, that are displayed in the file manager. This context contains emblems for such things as read-only or photos EmblemIcons // Icons for emotions that are expressed through text chat applications such as :-) or :-P in IRC or instant messengers. EmoteIcons // Icons for international denominations such as flags. IntnlIcons // Icons for different types of data, such as audio or image files. MimeIcons // Icons used to represent locations, either on the local filesystem, or through remote connections. Folders, trash, and workgroups are some example. PlaceIcons // Icons for presenting status to the user. This context contains icons for warning and error dialogs, as well as for the current weather, appointment alarms, and battery status StatusIcons IconContextsN )
func (*IconContexts) FromString ¶
func (i *IconContexts) FromString(s string) error
func (IconContexts) MarshalJSON ¶
func (ev IconContexts) MarshalJSON() ([]byte, error)
func (IconContexts) String ¶
func (i IconContexts) String() string
func (*IconContexts) UnmarshalJSON ¶
func (ev *IconContexts) UnmarshalJSON(b []byte) error
type IconSet ¶
an IconSet is a collection of icons styled in the same themes - lookup by name
var CurIconSet *IconSet = DefaultIconSet
the current icon set can be set to any icon set
var DefaultIconSet *IconSet = MakeDefaultIcons()
the default icon set is loaded by default
func MakeDefaultIcons ¶
func MakeDefaultIcons() *IconSet
note: icons must use a normalized 0-1 coordinate system!
type ImagePaintServer ¶
Image PaintServer
func (*ImagePaintServer) ServerType ¶
func (p *ImagePaintServer) ServerType() PaintServers
type IntValueView ¶
type IntValueView struct {
ValueViewBase
}
IntValueView presents a spinbox
func (*IntValueView) ConfigWidget ¶
func (vv *IntValueView) ConfigWidget(widg Node2D)
func (*IntValueView) New ¶
func (n *IntValueView) New() ki.Ki
func (*IntValueView) UpdateWidget ¶
func (vv *IntValueView) UpdateWidget()
func (*IntValueView) WidgetType ¶
func (vv *IntValueView) WidgetType() reflect.Type
type KeyFunctions ¶
type KeyFunctions int64
functions that keyboard events can perform in the gui
const ( KeyFunNil KeyFunctions = iota KeyFunMoveUp KeyFunMoveDown KeyFunMoveRight KeyFunMoveLeft KeyFunPageUp KeyFunPageDown KeyFunPageRight KeyFunPageLeft KeyFunHome KeyFunEnd KeyFunFocusNext KeyFunFocusPrev KeyFunSelectItem // enter KeyFunAccept // accept any changes and close dialog / move to next KeyFunAbort KeyFunCancelSelect KeyFunExtendSelect KeyFunSelectText KeyFunEditItem KeyFunCopy KeyFunCut KeyFunPaste KeyFunBackspace KeyFunDelete KeyFunKill KeyFunDuplicate KeyFunInsert KeyFunInsertAfter KeyFunGoGiEditor // either shift key KeyFunShift // the control key: command for mac, ctrl for others? KeyFunCtrl KeyFunZoomOut KeyFunZoomIn KeyFunPrefs KeyFunRefresh KeyFunctionsN )
func KeyFun ¶
func KeyFun(chord string) KeyFunctions
translate chord into keyboard function -- use oswin key.ChordString to get chord
func (*KeyFunctions) FromString ¶
func (i *KeyFunctions) FromString(s string) error
func (KeyFunctions) MarshalJSON ¶
func (ev KeyFunctions) MarshalJSON() ([]byte, error)
func (KeyFunctions) String ¶
func (i KeyFunctions) String() string
func (*KeyFunctions) UnmarshalJSON ¶
func (ev *KeyFunctions) UnmarshalJSON(b []byte) error
type KeyMap ¶
type KeyMap map[string]KeyFunctions
var ActiveKeyMap *KeyMap = &DefaultKeyMap
ActiveKeyMap points to the active map -- users can set this to an alternative map in Prefs
type KiPtrValueView ¶
type KiPtrValueView struct {
ValueViewBase
}
KiPtrValueView provides a chooser for pointers to Ki objects
func (*KiPtrValueView) ConfigWidget ¶
func (vv *KiPtrValueView) ConfigWidget(widg Node2D)
func (*KiPtrValueView) KiStruct ¶
func (vv *KiPtrValueView) KiStruct() ki.Ki
get the Ki struct itself (or nil)
func (*KiPtrValueView) New ¶
func (n *KiPtrValueView) New() ki.Ki
func (*KiPtrValueView) UpdateWidget ¶
func (vv *KiPtrValueView) UpdateWidget()
func (*KiPtrValueView) WidgetType ¶
func (vv *KiPtrValueView) WidgetType() reflect.Type
type Label ¶
type Label struct { WidgetBase Text string `xml:"text" desc:"label to display"` }
Label is a widget for rendering text labels -- supports full widget model including box rendering
type Labeler ¶
type Labeler interface {
Label() string
}
the labeler interface provides a GUI-appropriate label (todo: rich text html tags!?) for an item -- 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 { Node2DBase Lay Layouts `xml:"lay" desc:"type of layout to use"` CSS ki.Props `` /* 191-byte string literal not displayed */ CSSAgg ki.Props `json:"-" xml:"-" desc:"aggregated css properties from all higher nodes down to me"` StackTop ki.Ptr `desc:"pointer to node to use as the top of the stack -- only node matching this pointer is rendered, even if this is nil"` ChildSize Vec2D `json:"-" xml:"-" desc:"total max size of children as laid out"` ExtraSize Vec2D `json:"-" xml:"-" desc:"extra size in each dim due to scrollbars we add"` HasScroll [Dims2DN]bool `json:"-" xml:"-" desc:"whether scrollbar is used for given dim"` Scrolls [Dims2DN]*ScrollBar `json:"-" xml:"-" desc:"scroll bars -- we fully manage them as needed"` GridSize image.Point `json:"-" xml:"-" desc:"computed size of a grid layout based on all the constraints -- computed during Size2D pass"` GridData [RowColN][]LayoutData `json:"-" xml:"-" desc:"grid data for rows in [0] and cols in [1]"` }
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., align-horiz for a LayoutRow layout, to determine left, right, center, justified). Layouts can automatically add scrollbars depending on the Overflow layout style
func (*Layout) AllocFromParent ¶
func (ly *Layout) 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) AsNode2D ¶
func (ly *Layout) AsNode2D() *Node2DBase
func (*Layout) AsViewport2D ¶
func (ly *Layout) AsViewport2D() *Viewport2D
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) ChildrenBBox2D ¶
func (*Layout) ComputeBBox2D ¶
func (*Layout) DeactivateScroll ¶
func (*Layout) DeleteScroll ¶
todo: we are leaking the scrollbars..
func (*Layout) FinalizeLayout ¶
func (ly *Layout) FinalizeLayout()
final pass through children to finalize the layout, computing summary size stats
func (*Layout) FocusChanged2D ¶
func (*Layout) GatherSizes ¶
func (ly *Layout) GatherSizes()
first pass: gather the size information from the children
func (*Layout) GatherSizesGrid ¶
func (ly *Layout) GatherSizesGrid()
first pass: gather the size information from the children, grid version
func (*Layout) LayoutAll ¶
layout all children along given dim -- only affects that dim -- e.g., use LayoutSingle for other dim
func (*Layout) LayoutGrid ¶
func (ly *Layout) LayoutGrid()
func (*Layout) LayoutGridDim ¶
layout grid data along each dimension (row, Y; col, X), same as LayoutAll. For cols, X has width prefs of each -- turn that into an actual allocated width for each column, and likewise for rows.
func (*Layout) LayoutScrolls ¶
func (ly *Layout) LayoutScrolls()
func (*Layout) LayoutSingle ¶
layout item in single-dimensional case -- e.g., orthogonal dimension from LayoutRow / Col
func (*Layout) LayoutSingleImpl ¶
func (ly *Layout) LayoutSingleImpl(avail, need, pref, max, spc float32, al Align) (pos, size float32)
calculations to layout a single-element dimension, returns pos and size
func (*Layout) ManageOverflow ¶
func (ly *Layout) ManageOverflow()
process any overflow according to overflow settings
func (*Layout) Move2DDelta ¶
we add our own offset here
func (*Layout) ReRender2D ¶
func (*Layout) RenderScrolls ¶
func (ly *Layout) RenderScrolls()
func (*Layout) ScrollDelta ¶
ScrollDelta processes a scroll event with given delta -- returns true if scroll was processed
func (*Layout) ShowChildAtIndex ¶
convenience for LayoutStacked to show child node at a given index
type LayoutData ¶
type LayoutData struct { Size SizePrefs `desc:"size constraints for this item -- from layout style"` Margins Margins `desc:"margins around this item"` GridPos image.Point `desc:"position within a grid"` GridSpan image.Point `desc:"number of grid elements that we take up in each direction"` AllocSize Vec2D `desc:"allocated size of this item, by the parent layout"` AllocPos Vec2D `desc:"position of this item, computed by adding in the AllocPosRel to parent position"` AllocPosRel Vec2D `desc:"allocated relative position of this item, computed by the parent layout"` AllocPosOrig Vec2D `` /* 134-byte string literal not displayed */ }
LayoutData contains all the data needed to specify the layout of an item within a layout -- includes computed values of style prefs -- everything is concrete and specified here, whereas style may not be fully resolved
func (*LayoutData) Defaults ¶
func (ld *LayoutData) Defaults()
func (*LayoutData) Reset ¶
func (ld *LayoutData) Reset()
called at start of layout process -- resets all values back to 0
func (*LayoutData) SetFromStyle ¶
func (ld *LayoutData) SetFromStyle(ls *LayoutStyle)
func (*LayoutData) UpdateSizes ¶
func (ld *LayoutData) UpdateSizes()
update our sizes based on AllocSize and Max constraints, etc
type LayoutStyle ¶
type LayoutStyle struct { AlignH Align `` /* 127-byte string literal not displayed */ AlignV Align `` /* 127-byte string literal not displayed */ PosX units.Value `xml:"x" desc:"horizontal position -- often superceded by layout but otherwise used"` PosY units.Value `xml:"y" desc:"vertical position -- often superceded by layout but otherwise used"` Width units.Value `xml:"width" desc:"specified size of element -- 0 if not specified"` Height units.Value `xml:"height" desc:"specified size of element -- 0 if not specified"` MaxWidth units.Value `xml:"max-width" desc:"specified maximum size of element -- 0 means just use other values, negative means stretch"` MaxHeight units.Value `xml:"max-height" desc:"specified maximum size of element -- 0 means just use other values, negative means stretch"` MinWidth units.Value `xml:"min-width" desc:"specified mimimum size of element -- 0 if not specified"` MinHeight units.Value `xml:"min-height" desc:"specified mimimum size of element -- 0 if not specified"` Margin units.Value `xml:"margin" desc:"outer-most transparent space around box element -- todo: can be specified per side"` Padding units.Value `` /* 185-byte string literal not displayed */ Overflow Overflow `` /* 147-byte string literal not displayed */ Columns int `` /* 178-byte string literal not displayed */ Row int `xml:"row" desc:"specifies the row that this element should appear within a grid layout"` Col int `xml:"col" desc:"specifies the column that this element should appear within a grid layout"` RowSpan int `` /* 146-byte string literal not displayed */ ColSpan int `xml:"col-span" desc:"specifies the number of sequential columns that this element should occupy within a grid layout"` ScrollBarWidth units.Value `xml:"scrollbar-width" desc:"width of a layout scrollbar"` // contains filtered or unexported fields }
style preferences on the layout of the element
func (*LayoutStyle) AlignDim ¶
func (ls *LayoutStyle) AlignDim(d Dims2D) Align
return the alignment for given dimension
func (*LayoutStyle) Defaults ¶
func (ls *LayoutStyle) Defaults()
func (*LayoutStyle) MaxSizeDots ¶
func (ls *LayoutStyle) MaxSizeDots() Vec2D
size max settings, in dots
func (*LayoutStyle) MinSizeDots ¶
func (ls *LayoutStyle) MinSizeDots() Vec2D
size min settings, in dots
func (*LayoutStyle) SetStylePost ¶
func (ls *LayoutStyle) SetStylePost()
type Layouts ¶
type Layouts int32
different types of layouts
const ( // arrange items horizontally across a row LayoutRow Layouts = iota // arrange items vertically in a column LayoutCol // arrange items according to a grid LayoutGrid // arrange items horizontally across a row, overflowing vertically as needed LayoutRowFlow // arrange items vertically within a column, overflowing horizontally as needed LayoutColFlow // arrange items stacked on top of each other -- Top index indicates which to show -- overall size accommodates largest in each dimension LayoutStacked // nil layout -- don'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 Line ¶
type Line struct { Node2DBase Start Vec2D `xml:"{x1,y1}" desc:"position of the start of the line"` End Vec2D `xml:"{x2, y2}" desc:"position of the end of the line"` }
a 2D line
func (*Line) ReRender2D ¶
type LineCap ¶
type LineCap int
end-cap of a line: stroke-linecap property in SVG
func (*LineCap) FromString ¶
func (LineCap) MarshalJSON ¶
func (*LineCap) UnmarshalJSON ¶
type LineJoin ¶
type LineJoin int
the way in which lines are joined together: stroke-linejoin property in SVG
func (*LineJoin) FromString ¶
func (LineJoin) MarshalJSON ¶
func (*LineJoin) UnmarshalJSON ¶
type MakeMenuFunc ¶
type MakeMenuFunc func(mb *ButtonBase)
MakeMenuFunc is a callback for making the menu on demand
type MapInlineValueView ¶
type MapInlineValueView struct {
ValueViewBase
}
MapInlineValueView presents a MapViewInline for a map
func (*MapInlineValueView) ConfigWidget ¶
func (vv *MapInlineValueView) ConfigWidget(widg Node2D)
func (*MapInlineValueView) New ¶
func (n *MapInlineValueView) New() ki.Ki
func (*MapInlineValueView) UpdateWidget ¶
func (vv *MapInlineValueView) UpdateWidget()
func (*MapInlineValueView) WidgetType ¶
func (vv *MapInlineValueView) WidgetType() reflect.Type
type MapValueView ¶
type MapValueView struct {
ValueViewBase
}
MapValueView presents a button to edit maps
func (*MapValueView) ConfigWidget ¶
func (vv *MapValueView) ConfigWidget(widg Node2D)
func (*MapValueView) New ¶
func (n *MapValueView) New() ki.Ki
func (*MapValueView) UpdateWidget ¶
func (vv *MapValueView) UpdateWidget()
func (*MapValueView) WidgetType ¶
func (vv *MapValueView) WidgetType() reflect.Type
type MapView ¶
type MapView struct { Frame Map interface{} `desc:"the map that we are a view onto"` Title string `desc:"title / prompt to show above the editor fields"` Keys []ValueView `json:"-" xml:"-" desc:"ValueView representations of the map keys"` Values []ValueView `json:"-" xml:"-" desc:"ValueView representations of the map values"` TmpSave ValueView `` /* 189-byte string literal not displayed */ ViewSig ki.Signal `` /* 179-byte string literal not displayed */ }
MapView represents a map, creating a property editor of the values -- constructs Children widgets to show the key / value pairs, within an overall frame with an optional title, and a button box at the bottom where methods can be invoked
func (*MapView) ButtonBox ¶
ButtonBox returns the ButtonBox layout widget, and its index, within frame -- nil, -1 if not found
func (*MapView) ConfigMapButtons ¶
func (mv *MapView) ConfigMapButtons()
ConfigMapButtons configures the buttons for map functions
func (*MapView) ConfigMapGrid ¶
func (mv *MapView) ConfigMapGrid()
ConfigMapGrid configures the MapGrid for the current map
func (*MapView) MapChangeValueType ¶
MapChangeValueType changes the type of the value for given map element at idx -- for maps with interface{} values
func (*MapView) MapGrid ¶
MapGrid returns the MapGrid grid layout widget, which contains all the fields and values, and its index, within frame -- nil, -1 if not found
func (*MapView) ReRender2D ¶
func (*MapView) SetMap ¶
SetMap sets the source map that we are viewing -- rebuilds the children to represent this map
func (*MapView) StdConfig ¶
StdConfig configures a standard setup of the overall Frame -- returns mods, updt from ConfigChildren and does NOT call UpdateEnd
func (*MapView) StdFrameConfig ¶
func (mv *MapView) StdFrameConfig() kit.TypeAndNameList
StdFrameConfig returns a TypeAndNameList for configuring a standard Frame -- can modify as desired before calling ConfigChildren on Frame using this
func (*MapView) Style2D ¶
func (mv *MapView) Style2D()
needs full rebuild and this is where we do it:
func (*MapView) TitleWidget ¶
Title returns the title label widget, and its index, within frame -- nil, -1 if not found
func (*MapView) UpdateFromMap ¶
func (mv *MapView) UpdateFromMap()
func (*MapView) UpdateValues ¶
func (mv *MapView) UpdateValues()
type MapViewInline ¶
type MapViewInline struct { WidgetBase Map interface{} `desc:"the map that we are a view onto"` Keys []ValueView `json:"-" xml:"-" desc:"ValueView representations of the map keys"` Values []ValueView `json:"-" xml:"-" desc:"ValueView representations of the fields"` TmpSave ValueView `` /* 189-byte string literal not displayed */ ViewSig ki.Signal `` /* 179-byte string literal not displayed */ }
MapViewInline represents a map as a single line widget, for smaller maps and those explicitly marked inline -- constructs widgets in Parts to show the key names and editor vals for each value
func (*MapViewInline) ConfigParts ¶
func (mv *MapViewInline) ConfigParts()
ConfigParts configures Parts for the current map
func (*MapViewInline) New ¶
func (n *MapViewInline) New() ki.Ki
func (*MapViewInline) ReRender2D ¶
func (mv *MapViewInline) ReRender2D() (node Node2D, layout bool)
todo: see notes on treeview
func (*MapViewInline) Render2D ¶
func (mv *MapViewInline) Render2D()
func (*MapViewInline) SetMap ¶
func (mv *MapViewInline) SetMap(mp interface{}, tmpSave ValueView)
SetMap sets the source map that we are viewing -- rebuilds the children to represent this map
func (*MapViewInline) Style2D ¶
func (mv *MapViewInline) Style2D()
func (*MapViewInline) UpdateFromMap ¶
func (mv *MapViewInline) UpdateFromMap()
func (*MapViewInline) UpdateValues ¶
func (mv *MapViewInline) UpdateValues()
type MenuButton ¶
type MenuButton struct {
ButtonBase
}
func (*MenuButton) ButtonAsBase ¶
func (g *MenuButton) ButtonAsBase() *ButtonBase
func (*MenuButton) ConfigParts ¶
func (g *MenuButton) ConfigParts()
func (*MenuButton) New ¶
func (n *MenuButton) New() ki.Ki
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 Node2D ¶
type Node2D interface { // nodes are Ki elements -- this comes for free by embedding ki.Node in all Node2D elements ki.Ki // 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 // Init2D initializes a node -- sets up event receiving connections etc -- // must call InitNodeBase as first step set basic inits including setting // Viewport and connecting node signal to parent vp -- 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() // CSSProps: returns pointers to the css properties for this node, if node // supports css styles -- both the local CSS settings and the aggregated // values down to it CSSProps() (css, agg *ki.Props) // Size2D: DepthFirst 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() // 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 Layout2D(parBBox image.Rectangle) // 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 Render2D() // ReRender2D: returns the node that should be re-rendered when an Update // signal is received for a given node, and whether a new layout pass from // that node down is needed) -- can be the node itself, any of its parents // or children, or nil to indicate that a full re-render is necessary. // For re-rendering to work, an opaque background should be painted first ReRender2D() (node Node2D, layout bool) // FocusChanged2D is called on node when it gets or loses focus -- focus // flag has current state too FocusChanged2D(gotFocus bool) // 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 }
primary interface for all Node2D nodes
type Node2DBase ¶
type Node2DBase struct { NodeBase Style Style `` /* 137-byte string literal not displayed */ DefStyle *Style `` /* 198-byte string literal not displayed */ Paint Paint `json:"-" xml:"-" desc:"full paint information for this node"` Viewport *Viewport2D `json:"-" xml:"-" desc:"our viewport -- set in Init2D (Base typically) and used thereafter"` LayData LayoutData `json:"-" xml:"-" desc:"all the layout information for this item"` }
Base struct node for 2D rendering tree -- renders to a bitmap using Paint rendering functions operating on the RenderState in the parent Viewport
Rendering is done in 4 separate passes:
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: DepthFirst 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
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
* Move2D: optional pass invoked by scrollbars to move elements relative to their previously-assigned positions.
func (*Node2DBase) AddParentPos ¶
func (g *Node2DBase) AddParentPos() Vec2D
add 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 (*Node2DBase) AsLayout2D ¶
func (g *Node2DBase) AsLayout2D() *Layout
func (*Node2DBase) AsNode2D ¶
func (g *Node2DBase) AsNode2D() *Node2DBase
func (*Node2DBase) AsViewport2D ¶
func (g *Node2DBase) AsViewport2D() *Viewport2D
func (*Node2DBase) BBox2D ¶
func (g *Node2DBase) BBox2D() image.Rectangle
func (*Node2DBase) BBoxFromAlloc ¶
func (g *Node2DBase) BBoxFromAlloc() image.Rectangle
get our bbox from Layout allocation
func (*Node2DBase) BBoxReport ¶
func (g *Node2DBase) BBoxReport() string
report on all the bboxes for everything in the tree
func (*Node2DBase) CSSProps ¶
func (g *Node2DBase) CSSProps() (css, agg *ki.Props)
func (*Node2DBase) ChildrenBBox2D ¶
func (g *Node2DBase) ChildrenBBox2D() image.Rectangle
func (*Node2DBase) ChildrenBBox2DWidget ¶
func (g *Node2DBase) ChildrenBBox2DWidget() image.Rectangle
this provides a basic widget box-model subtraction of margin and padding to children -- call in ChildrenBBox2D for most widgets
func (*Node2DBase) ComputeBBox2D ¶
func (g *Node2DBase) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)
func (*Node2DBase) ComputeBBox2DBase ¶
func (g *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) CopyParentPaint ¶
func (g *Node2DBase) CopyParentPaint() *Node2DBase
CopyParentPaint copy our paint from our parents -- called during Style for SVG
func (*Node2DBase) DefaultStyle2DWidget ¶
func (g *Node2DBase) DefaultStyle2DWidget(selector string, part *Node2DBase) *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
func (*Node2DBase) FocusChanged2D ¶
func (g *Node2DBase) FocusChanged2D(gotFocus bool)
func (*Node2DBase) FullRender2DTree ¶
func (g *Node2DBase) FullRender2DTree()
full render of the tree
func (*Node2DBase) HasFocus2D ¶
func (g *Node2DBase) HasFocus2D() bool
func (*Node2DBase) Init2D ¶
func (g *Node2DBase) Init2D()
func (*Node2DBase) Init2DBase ¶
func (g *Node2DBase) Init2DBase()
handles basic node initialization -- Init2D can then do special things
func (*Node2DBase) Init2DTree ¶
func (g *Node2DBase) Init2DTree()
initialize 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) InitLayout2D ¶
func (g *Node2DBase) InitLayout2D()
func (*Node2DBase) Layout2D ¶
func (g *Node2DBase) Layout2D(parBBox image.Rectangle)
func (*Node2DBase) Layout2DBase ¶
func (g *Node2DBase) Layout2DBase(parBBox image.Rectangle, initStyle bool)
basic Layout2D functions -- good for most cases
func (*Node2DBase) Layout2DChildren ¶
func (g *Node2DBase) Layout2DChildren()
layout on all of node's children, giving them the ChildrenBBox2D -- default call at end of Layout2D
func (*Node2DBase) Layout2DTree ¶
func (g *Node2DBase) Layout2DTree()
layout pass -- each node iterates over children for maximum control -- this starts with parent VpBBox -- can be called de novo
func (*Node2DBase) Move2DBase ¶
func (g *Node2DBase) Move2DBase(delta image.Point, parBBox image.Rectangle)
func (*Node2DBase) Move2DChildren ¶
func (g *Node2DBase) Move2DChildren(delta image.Point)
move all of node's children, giving them the ChildrenBBox2D -- default call at end of Move2D
func (*Node2DBase) Move2DTree ¶
func (g *Node2DBase) Move2DTree()
move2d pass -- each node iterates over children for maximum control -- this starts with parent VpBBox and current delta -- can be called de novo
func (*Node2DBase) New ¶
func (n *Node2DBase) New() ki.Ki
func (*Node2DBase) ParentLayout ¶
func (g *Node2DBase) ParentLayout() *Layout
func (*Node2DBase) ParentReRenderAnchor ¶
func (g *Node2DBase) ParentReRenderAnchor() Node2D
find parent that is a ReRenderAnchor
func (*Node2DBase) ParentSVG ¶
func (g *Node2DBase) ParentSVG() *SVG
func (*Node2DBase) ParentViewport ¶
func (g *Node2DBase) ParentViewport() *Viewport2D
find parent viewport -- uses AsViewport2D() method on Node2D interface
func (*Node2DBase) ParentWindow ¶
func (g *Node2DBase) ParentWindow() *Window
func (*Node2DBase) PopBounds ¶
func (g *Node2DBase) PopBounds()
pop our bounding-box bounds -- last step in Render2D after rendering children
func (*Node2DBase) PushBounds ¶
func (g *Node2DBase) PushBounds() bool
if non-empty, push our bounding-box bounds onto the bounds stack -- 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 (*Node2DBase) ReRender2D ¶
func (g *Node2DBase) ReRender2D() (node Node2D, layout bool)
func (*Node2DBase) ReRender2DTree ¶
func (g *Node2DBase) ReRender2DTree()
re-render of the tree -- after it has already been initialized and styled -- just does layout and render passes
func (*Node2DBase) ReceiveEventType ¶
func (g *Node2DBase) ReceiveEventType(et oswin.EventType, fun ki.RecvFunc)
redefining this here gives access to the much faster ParentWindow method!
func (*Node2DBase) Render2D ¶
func (g *Node2DBase) Render2D()
func (*Node2DBase) Render2DChildren ¶
func (g *Node2DBase) Render2DChildren()
render all of node's children -- default call at end of Render2D()
func (*Node2DBase) Render2DTree ¶
func (g *Node2DBase) Render2DTree()
render 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) SetFixedHeight ¶
func (g *Node2DBase) SetFixedHeight(val units.Value)
set all height options (height, min-height, max-height) to a fixed height value
func (*Node2DBase) SetFixedWidth ¶
func (g *Node2DBase) SetFixedWidth(val units.Value)
set all width options (width, min-width, max-width) to a fixed width value
func (*Node2DBase) SetMinPrefHeight ¶
func (g *Node2DBase) SetMinPrefHeight(val units.Value)
set minimum and preferred height-- will get at least this amount -- max unspecified
func (*Node2DBase) SetMinPrefWidth ¶
func (g *Node2DBase) SetMinPrefWidth(val units.Value)
set minimum and preferred width -- will get at least this amount -- max unspecified
func (*Node2DBase) SetStretchMaxHeight ¶
func (g *Node2DBase) SetStretchMaxHeight()
set stretchy max height -- can grow to take up avail room
func (*Node2DBase) SetStretchMaxWidth ¶
func (g *Node2DBase) SetStretchMaxWidth()
set stretchy max width -- can grow to take up avail room
func (*Node2DBase) SetWinBBox ¶
func (g *Node2DBase) SetWinBBox()
set our window-level BBox from vp and our bbox
func (*Node2DBase) Size2D ¶
func (g *Node2DBase) Size2D()
func (*Node2DBase) Size2DTree ¶
func (g *Node2DBase) Size2DTree()
do the sizing as a depth-first pass
func (*Node2DBase) Style2D ¶
func (g *Node2DBase) Style2D()
func (*Node2DBase) Style2DSVG ¶
func (g *Node2DBase) Style2DSVG()
Style2DSVG styles the Paint values directly from node properties -- for SVG-style nodes -- no relevant default styling here -- parents can just set props directly as needed
func (*Node2DBase) Style2DTree ¶
func (g *Node2DBase) Style2DTree()
style 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) Style2DWidget ¶
func (g *Node2DBase) Style2DWidget()
Style2DWidget styles the Style values from node properties and optional base-level defaults -- for Widget-style nodes
func (*Node2DBase) StylePart ¶
func (g *Node2DBase) StylePart(pk ki.Ki)
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
type Node3DBase ¶
type Node3DBase struct {
NodeBase
}
basic component node for 3D rendering -- has a 3D transform
func (*Node3DBase) New ¶
func (n *Node3DBase) New() ki.Ki
type NodeBase ¶
type NodeBase struct { ki.Node Class string `desc:"user-defined class name used primarily for attaching CSS styles to different display elements"` BBox image.Rectangle `` /* 192-byte string literal not displayed */ VpBBox image.Rectangle `` /* 231-byte string literal not displayed */ WinBBox image.Rectangle `` /* 198-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) ClearFullReRender ¶
func (g *NodeBase) ClearFullReRender()
clear node as needing a full ReRender
func (*NodeBase) DisconnectAllEvents ¶
disconnect node from all events
func (*NodeBase) DisconnectAllEventsTree ¶
disconnect node from all events - todo: need a more generic Ki version of this
func (*NodeBase) IsDragging ¶
is the current node currently receiving dragging events? set by window
func (*NodeBase) IsInactive ¶
is this node Inactive? if so, behave (ignore events) and style appropriately
func (*NodeBase) IsReRenderAnchor ¶
is the current node a ReRenderAnchor?
func (*NodeBase) NeedsFullReRender ¶
node needs full re-render?
func (*NodeBase) ParentWindow ¶
func (*NodeBase) PointToRelPos ¶
translate a point in global pixel coords into relative position within node
func (*NodeBase) ReceiveEventType ¶
register this node to receive a given type of GUI event signal from the parent window
func (*NodeBase) SetCanFocusIfActive ¶
func (g *NodeBase) SetCanFocusIfActive()
set CanFocus only if not inactive
func (*NodeBase) SetFullReRender ¶
func (g *NodeBase) SetFullReRender()
set node as needing a full ReRender
func (*NodeBase) SetInactiveState ¶
set inactive state of the node
func (*NodeBase) SetReRenderAnchor ¶
func (g *NodeBase) SetReRenderAnchor()
set node as a ReRenderAnchor
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 int32
gi node flags are 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
const ( // button is selected ButtonFlagSelected NodeFlags = NodeFlagsN + iota // button is checkable -- enables display of check control ButtonFlagCheckable // button is checked ButtonFlagChecked // Menu flag means that the button is a menu item ButtonFlagMenu ButtonFlagsN )
these extend NodeBase NodeFlags to hold button state
const ( NodeFlagsNil NodeFlags = NodeFlags(ki.FlagsN) + iota // 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 // Inactive disables interaction with widgets or other nodes -- they // should indicate this inactive state in an appropriate way, and not // process input events Inactive // InactiveEvents overrides the default behavior where inactive nodes are // not sent events from the Window -- for e.g., the TextField which can // still be selected and copied when inactive InactiveEvents // MouseHasEntered indicates that the MouseEnteredEvent was previously // registered on this node MouseHasEntered // NodeDragging indicates this node is currently dragging -- win.Dragging // set to this node NodeDragging // can extend node flags from here NodeFlagsN )
const ( // node is closed TreeViewFlagClosed NodeFlags = NodeFlagsN + iota // node is selected TreeViewFlagSelected // the shift key was pressed, putting the selection mode into continous selection mode TreeViewFlagContinuousSelect // the ctrl / cmd key was pressed, putting the selection mode into continous selection mode TreeViewFlagExtendSelect )
these extend NodeBase NodeFlags to hold TreeView state
const ( // VpFlagPopup means viewport is a popup (menu or dialog) -- does not obey // parent bounds (otherwise does) VpFlagPopup NodeFlags = NodeFlagsN + iota // VpFlagMenu means viewport is serving as a popup menu -- affects how window // processes clicks VpFlagMenu // 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 mans that this viewport is an SVG viewport -- SVG elements // look for this for re-rendering VpFlagSVG // VpFlagDrawIntoWin means it should draw into window directly instead of // drawing into parent -- i.e., as a sprite VpFlagDrawIntoWin )
these flags extend NodeBase NodeFlags to hold viewport state
func StringToNodeFlags ¶
type Overflow ¶
type Overflow int32
overflow type -- determines what happens when there is too much stuff in a layout
const ( // automatically add scrollbars as needed -- this is pretty much the only sensible option, and is the default here, but Visible is default in html OverflowAuto Overflow = iota // pretty much the same as auto -- we treat it as such OverflowScroll // make the overflow visible -- this is generally unsafe and not very feasible and will be ignored as long as possible -- currently falls back on auto, but could go to Hidden if that works better overall OverflowVisible // hide the overflow and don'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 FillStyle FillStyle FontStyle FontStyle TextStyle TextStyle XForm XFormMatrix2D `xml:"-" json:"-" desc:"our additions to transform -- pushed to render state"` // contains filtered or unexported fields }
The Paint object provides the full context (parameters) and functions for painting onto an image -- image is always passed as an argument so it can be applied to anything
var PaintDefault Paint
PaintDefault is default style can be used when property specifies "default"
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
get the bounding box for an element in pixel int coordinates
func (*Paint) BoundingBoxFromPoints ¶
func (pc *Paint) BoundingBoxFromPoints(rs *RenderState, points []Vec2D) image.Rectangle
get 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) 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). Because freetype/raster does not support cubic beziers, this is emulated with many small line segments.
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, x, y, rx, ry, angle1, angle2 float32)
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 []Vec2D)
func (*Paint) DrawPolyline ¶
func (pc *Paint) DrawPolyline(rs *RenderState, points []Vec2D)
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) DrawString ¶
func (pc *Paint) DrawString(rs *RenderState, s string, x, y, width float32)
DrawString according to current settings -- width is needed for alignment -- if non-zero, then x position is for the left edge of the width box, and alignment is WRT that width -- otherwise x position is as in DrawStringAnchored
func (*Paint) DrawStringAnchored ¶
func (pc *Paint) DrawStringAnchored(rs *RenderState, s string, x, y, ax, ay, width float32)
DrawStringAnchored draws the specified text at the specified anchor point. The anchor point is x - w * ax, y - h * ay, where w, h is the size of the text. Use ax=0.5, ay=0.5 to center the text at the specified point.
func (*Paint) DrawStringLines ¶
func (pc *Paint) DrawStringLines(rs *RenderState, lines []string, x, y, width, height float32)
func (*Paint) DrawStringLinesAnchored ¶
func (pc *Paint) DrawStringLinesAnchored(rs *RenderState, lines []string, x, y, ax, ay, width, h, lineHeight float32)
func (*Paint) DrawStringWrapped ¶
func (pc *Paint) DrawStringWrapped(rs *RenderState, s string, x, y, ax, ay, width, lineHeight float32)
DrawStringWrapped word-wraps the specified string to the given max width and then draws it at the specified anchor point using the given line spacing and text alignment.
func (*Paint) Fill ¶
func (pc *Paint) Fill(rs *RenderState)
Fill fills the current path with the current color. Open subpaths are implicity closed. The path is cleared after this operation.
func (*Paint) FillBox ¶
func (pc *Paint) FillBox(rs *RenderState, pos, size Vec2D, clr color.Color)
Fill box is an optimized fill of a square region with a uniform color -- currently Fill is the major bottleneck on performance..
func (*Paint) FillPreserve ¶
func (pc *Paint) FillPreserve(rs *RenderState)
FillPreserve fills the current path with the current color. Open subpaths are implicity 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) FontHeight ¶
FontHeight -- returns the height of the current font
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) 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) MeasureChars ¶
MeasureChars measures the rendered character positions of the given text in the current font
func (*Paint) MeasureString ¶
MeasureString returns the rendered width and height of the specified text given the current font face.
func (*Paint) MeasureStringWrapped ¶
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) SetFontFace ¶
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) SetStyle ¶
SetStyle 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 Vec2D)
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) 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) ToDots ¶
func (pc *Paint) ToDots()
ToDots calls ToDots on all units.Value fields in the style (recursively) -- need to have set the UnContext first -- only after layout at render time is that possible
func (*Paint) TransformPoint ¶
func (pc *Paint) TransformPoint(rs *RenderState, x, y float32) Vec2D
TransformPoint multiplies the specified point by the current transform matrix, returning a transformed position.
type PaintServer ¶
type PaintServer interface { ColorAt(x, y int) color.Color ServerType() PaintServers }
func NewImagePaintServer ¶
func NewImagePaintServer(im image.Image, op RepeatOp) PaintServer
func NewSolidcolorPaintServer ¶
func NewSolidcolorPaintServer(color color.Color) PaintServer
type PaintServers ¶
type PaintServers int32
PaintServers provide patterned colors for stroke and fill operations
const ( PaintSolidcolor PaintServers = iota PaintLinearGradient PaintRadialGradient PaintMeshGradient PaintPattern PaintHatch PaintHatchpath PaintImage // apparently not SVG-standard but we have it. PaintServersN )
func (*PaintServers) FromString ¶
func (i *PaintServers) FromString(s string) error
func (PaintServers) MarshalJSON ¶
func (ev PaintServers) MarshalJSON() ([]byte, error)
func (PaintServers) String ¶
func (i PaintServers) String() string
func (*PaintServers) UnmarshalJSON ¶
func (ev *PaintServers) UnmarshalJSON(b []byte) error
type Path ¶
type Path struct { Node2DBase Data []PathData `` /* 171-byte string literal not displayed */ MinCoord Vec2D `desc:"minimum coord in path -- computed in BBox2D"` MaxCoord Vec2D `desc:"maximum coord in path -- computed in BBox2D"` }
2D Path, using SVG-style data that can render just about anything
func (*Path) ReRender2D ¶
type PathCmds ¶
type PathCmds byte
the commands within the path SVG drawing data type
const ( // move pen, abs coords PcM PathCmds = iota // move pen, rel coords Pcm // lineto, abs PcL // lineto, rel Pcl // horizontal lineto, abs PcH // relative lineto, rel Pch // vertical lineto, abs PcV // vertical lineto, rel Pcv // Bezier curveto, abs PcC // Bezier curveto, rel Pcc // smooth Bezier curveto, abs PcS // smooth Bezier curveto, rel Pcs // quadratic Bezier curveto, abs PcQ // quadratic Bezier curveto, rel Pcq // smooth quadratic Bezier curveto, abs PcT // smooth quadratic Bezier curveto, rel Pct // elliptical arc, abs PcA // elliptical arc, rel Pca // close path PcZ // close path Pcz )
type PathData ¶
type PathData float32
to encode the data, we use 32-bit floats which are converted into int32 for path commands, which contain the number of data points following the path command to interpret as numbers, in the lower and upper 2 bytes of the converted int32 number we don't need that many bits, but keeping 32-bit alignment is probably good and really these things don't need to be crazy compact as it is unlikely to make a relevant diff in size or perf to pack down further
func PathDataNext ¶
PathDataNext gets the next path data element, incrementing the index -- ++ not an expression so its clunky -- hopefully this is inlined..
func PathDataParse ¶
type Polygon ¶
type Polygon struct { Node2DBase Points []Vec2D `` /* 137-byte string literal not displayed */ }
2D Polygon
func (*Polygon) ReRender2D ¶
type Polyline ¶
type Polyline struct { Node2DBase Points []Vec2D `xml:"points" desc:"the coordinates to draw -- does a moveto on the first, then lineto for all the rest"` }
2D Polyline
func (*Polyline) ReRender2D ¶
type Preferences ¶
type Preferences struct { LogicalDPIScale float32 `` /* 148-byte string literal not displayed */ ScreenPrefs map[string]Preferences DialogsSepWindow bool `desc:"do dialog windows open in a separate OS-level window, or do they open within the same parent window"` DoubleClickMSec int `min:"100" step:"50" desc:"the maximum time interval in msec between button press events to count as a double-click"` FontColor Color `desc:"default font / pen color"` BackgroundColor Color `desc:"default background color"` ShadowColor Color `desc:"color for shadows -- should generally be a darker shade of the background color"` BorderColor Color `desc:"default border color, for button, frame borders, etc"` ControlColor Color `desc:"default main color for controls: buttons, etc"` IconColor Color `desc:"color for icons or other solidly-colored, small elements"` SelectColor Color `desc:"color for selected elements"` CustomKeyMap KeyMap `desc:"customized mapping from keys to interface functions"` PrefsOverride bool `` /* 146-byte string literal not displayed */ CustomStyles ki.Props `` /* 189-byte string literal not displayed */ FontPaths []string `desc:"extra font paths, beyond system defaults -- searched first"` }
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 (p *Preferences) Apply()
Apply preferences to all the relevant settings
func (*Preferences) DefaultKeyMap ¶
func (p *Preferences) DefaultKeyMap()
DefaultKeyMap installs the current default key map, prior to editing
func (*Preferences) Defaults ¶
func (p *Preferences) Defaults()
func (*Preferences) Load ¶
func (p *Preferences) Load() error
Load preferences from GoGi standard prefs directory
func (*Preferences) Save ¶
func (p *Preferences) Save() error
Save Preferences to GoGi standard prefs directory
func (*Preferences) Update ¶
func (p *Preferences) Update()
Update everything with current preferences -- triggers rebuild of default styles
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 Rect ¶
type Rect struct { Node2DBase Pos Vec2D `xml:"{x,y}" desc:"position of the top-left of the rectangle"` Size Vec2D `xml:"{width,height}" desc:"size of the rectangle"` Radius Vec2D `xml:"{rx,ry}" desc:"radii for curved corners, as a proportion of width, height"` }
2D rectangle, optionally with rounded corners
func (*Rect) ReRender2D ¶
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 { XForm XFormMatrix2D `desc:"current transform"` StrokePath raster.Path `desc:"current stroke path"` FillPath raster.Path `desc:"current fill path"` Start Vec2D `desc:"starting point, for close path"` Current Vec2D `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 */ XFormStack []XFormMatrix2D `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"` }
The RenderState holds all the current rendering state information used while painting -- a viewport just has one of these
func (*RenderState) Defaults ¶
func (rs *RenderState) Defaults()
func (*RenderState) PopBounds ¶
func (rs *RenderState) PopBounds()
pop bounds off the stack and set to current bounds
func (*RenderState) PopClip ¶
func (rs *RenderState) PopClip()
pop Mask off the clip stack and set to current mask
func (*RenderState) PopXForm ¶
func (rs *RenderState) PopXForm()
pop xform off the stack and set to current xform
func (*RenderState) PushBounds ¶
func (rs *RenderState) PushBounds(b image.Rectangle)
push current bounds onto stack and set new bounds
func (*RenderState) PushClip ¶
func (rs *RenderState) PushClip()
push current Mask onto the clip stack
func (*RenderState) PushXForm ¶
func (rs *RenderState) PushXForm(xf XFormMatrix2D)
push current xform onto stack and apply new xform on top of it
type RepeatOp ¶
type RepeatOp int
todo: this is not SVG standard and needs to be updated for pattern paint server, the way in which the pattern repeats
type RowCol ¶
type RowCol int32
row / col for grid data
func (*RowCol) FromString ¶
func (RowCol) MarshalJSON ¶
func (*RowCol) UnmarshalJSON ¶
type SVG ¶
type SVG struct {
Viewport2D
}
SVG is a viewport for containing SVG drawing objects, correponding to the svg tag in html -- it provides its own bitmap for drawing into
type ScreenPrefs ¶
type ScreenPrefs struct {
LogicalDPIScale float32 `` /* 127-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 (*ScrollBar) FocusChanged2D ¶
func (*ScrollBar) Render2DDefaultStyle ¶
func (g *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
type ShadowStyle ¶
type ShadowStyle struct { HOffset units.Value `xml:".h-offset" desc:"horizontal offset of shadow -- positive = right side, negative = left side"` VOffset units.Value `xml:".v-offset" desc:"vertical offset of shadow -- positive = below, negative = above"` Blur units.Value `xml:".blur" desc:"blur radius -- higher numbers = more blurry"` Spread units.Value `xml:".spread" desc:"spread radius -- positive number increases size of shadow, negative descreases size"` Color Color `xml:".color" desc:"color of the shadow"` Inset bool `xml:".inset" desc:"shadow is inset within box instead of outset outside of box"` }
style parameters for shadows
func (*ShadowStyle) HasShadow ¶
func (s *ShadowStyle) HasShadow() bool
type SizePrefs ¶
type SizePrefs struct { Need Vec2D `desc:"minimum size needed -- set to at least computed allocsize"` Pref Vec2D `desc:"preferred size -- start here for layout"` Max Vec2D `desc:"maximum size -- will not be greater than this -- 0 = no constraint, neg = stretch"` }
size preferences
func (SizePrefs) CanStretchNeed ¶
return true if Pref > Need meaning can stretch more along given dimension
func (SizePrefs) HasMaxStretch ¶
return true if Max < 0 meaning can stretch infinitely along given dimension
type SliceValueView ¶
type SliceValueView struct {
ValueViewBase
}
SliceValueView presents a button to edit slices
func (*SliceValueView) ConfigWidget ¶
func (vv *SliceValueView) ConfigWidget(widg Node2D)
func (*SliceValueView) New ¶
func (n *SliceValueView) New() ki.Ki
func (*SliceValueView) UpdateWidget ¶
func (vv *SliceValueView) UpdateWidget()
func (*SliceValueView) WidgetType ¶
func (vv *SliceValueView) WidgetType() reflect.Type
type SliceView ¶
type SliceView struct { Frame Slice interface{} `desc:"the slice that we are a view onto"` Title string `desc:"title / prompt to show above the editor fields"` Values []ValueView `json:"-" xml:"-" desc:"ValueView representations of the slice values"` TmpSave ValueView `` /* 189-byte string literal not displayed */ ViewSig ki.Signal `` /* 179-byte string literal not displayed */ }
SliceView represents a slice, creating a property editor of the values -- constructs Children widgets to show the index / value pairs, within an overall frame with an optional title, and a button box at the bottom where methods can be invoked
func (*SliceView) ButtonBox ¶
ButtonBox returns the ButtonBox layout widget, and its index, within frame -- nil, -1 if not found
func (*SliceView) ConfigSliceButtons ¶
func (sv *SliceView) ConfigSliceButtons()
ConfigSliceButtons configures the buttons for map functions
func (*SliceView) ConfigSliceGrid ¶
func (sv *SliceView) ConfigSliceGrid()
ConfigSliceGrid configures the SliceGrid for the current slice
func (*SliceView) ReRender2D ¶
func (*SliceView) SetSlice ¶
SetSlice sets the source slice that we are viewing -- rebuilds the children to represent this slice
func (*SliceView) SliceDelete ¶
SliceDelete deletes element at given index from slice
func (*SliceView) SliceGrid ¶
SliceGrid returns the SliceGrid grid layout widget, which contains all the fields and values, and its index, within frame -- nil, -1 if not found
func (*SliceView) SliceNewAt ¶
SliceNewAt inserts a new blank element at given index in the slice -- -1 means the end
func (*SliceView) StdConfig ¶
StdConfig configures a standard setup of the overall Frame -- returns mods, updt from ConfigChildren and does NOT call UpdateEnd
func (*SliceView) StdFrameConfig ¶
func (sv *SliceView) StdFrameConfig() kit.TypeAndNameList
StdFrameConfig returns a TypeAndNameList for configuring a standard Frame -- can modify as desired before calling ConfigChildren on Frame using this
func (*SliceView) Style2D ¶
func (sv *SliceView) Style2D()
needs full rebuild and this is where we do it:
func (*SliceView) TitleWidget ¶
Title returns the title label widget, and its index, within frame -- nil, -1 if not found
func (*SliceView) UpdateFromSlice ¶
func (sv *SliceView) UpdateFromSlice()
func (*SliceView) UpdateValues ¶
func (sv *SliceView) UpdateValues()
type SliceViewInline ¶
type SliceViewInline struct { WidgetBase Slice interface{} `desc:"the slice that we are a view onto"` Values []ValueView `json:"-" xml:"-" desc:"ValueView representations of the fields"` TmpSave ValueView `` /* 189-byte string literal not displayed */ ViewSig ki.Signal `` /* 179-byte string literal not displayed */ }
SliceViewInline represents a slice as a single line widget, for smaller slices and those explicitly marked inline -- constructs widgets in Parts to show the key names and editor vals for each value
func (*SliceViewInline) ConfigParts ¶
func (sv *SliceViewInline) ConfigParts()
ConfigParts configures Parts for the current slice
func (*SliceViewInline) New ¶
func (n *SliceViewInline) New() ki.Ki
func (*SliceViewInline) ReRender2D ¶
func (sv *SliceViewInline) ReRender2D() (node Node2D, layout bool)
todo: see notes on treeview
func (*SliceViewInline) Render2D ¶
func (sv *SliceViewInline) Render2D()
func (*SliceViewInline) SetSlice ¶
func (sv *SliceViewInline) SetSlice(sl interface{}, tmpSave ValueView)
SetSlice sets the source slice that we are viewing -- rebuilds the children to represent this slice
func (*SliceViewInline) Style2D ¶
func (sv *SliceViewInline) Style2D()
func (*SliceViewInline) UpdateFromSlice ¶
func (sv *SliceViewInline) UpdateFromSlice()
func (*SliceViewInline) UpdateValues ¶
func (sv *SliceViewInline) UpdateValues()
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 (*Slider) FocusChanged2D ¶
func (*Slider) Render2DDefaultStyle ¶
func (g *Slider) Render2DDefaultStyle()
render using a default style if not otherwise styled
type SliderBase ¶
type SliderBase struct { WidgetBase Value float32 `xml:"value" desc:"current value"` EmitValue float32 `xml:"-" 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 `` /* 145-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 *Icon `json:"-" xml:"-" desc:"optional icon for the dragging knob"` ValThumb bool `` /* 269-byte string literal not displayed */ ThumbVal float32 `xml:thumb-val" desc:"value that the thumb represents, in the same units"` Pos float32 `xml:"pos" desc:"logical position of the slider relative to Size"` DragPos float32 `xml:"-" desc:"underlying drag position of slider -- not subject to snapping"` VisPos float32 `xml:"vispos" desc:"visual position of the slider -- can be different from pos in a RTL environment"` Dim Dims2D `desc:"dimension along which the slider slides"` Tracking bool `` /* 183-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"` State SliderStates `json:"-" xml:"-" desc:"state of slider"` StateStyles [SliderStatesN]Style `` /* 237-byte string literal not displayed */ SliderSig ki.Signal `json:"-" xml:"-" desc:"signal for slider -- see SliderSignals for the types"` // contains filtered or unexported fields }
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
var SliderDefault SliderBase
SliderDefault is default obj that can be used when property specifies "default"
func (*SliderBase) ConfigParts ¶
func (g *SliderBase) ConfigParts()
func (*SliderBase) ConfigPartsIfNeeded ¶
func (g *SliderBase) ConfigPartsIfNeeded(render bool)
func (*SliderBase) Defaults ¶
func (g *SliderBase) Defaults()
func (*SliderBase) Init2DSlider ¶
func (g *SliderBase) Init2DSlider()
func (*SliderBase) KeyInput ¶
func (g *SliderBase) KeyInput(kt *key.ChordEvent)
func (*SliderBase) New ¶
func (n *SliderBase) New() ki.Ki
func (*SliderBase) PointToRelPos ¶
func (g *SliderBase) PointToRelPos(pt image.Point) image.Point
translate a point in global pixel coords into relative position within node
func (*SliderBase) SetSliderPos ¶
func (g *SliderBase) SetSliderPos(pos float32)
SetSliderPos sets the position of the slider at the given position in pixels -- updates the corresponding Value
func (*SliderBase) SetSliderState ¶
func (g *SliderBase) SetSliderState(state SliderStates)
set the slider state to target
func (*SliderBase) SetThumbValue ¶
func (g *SliderBase) SetThumbValue(val float32)
func (*SliderBase) SetValue ¶
func (g *SliderBase) SetValue(val float32)
SetValue sets the value and updates the slider position, but does not emit an updated signal
func (*SliderBase) SetValueAction ¶
func (g *SliderBase) SetValueAction(val float32)
SetValueAction sets the value and updates the slider representation, and emits a changed signal
func (*SliderBase) SliderEnterHover ¶
func (g *SliderBase) SliderEnterHover()
slider starting hover-- todo: keep track of time and popup a tooltip -- signal?
func (*SliderBase) SliderMoved ¶
func (g *SliderBase) SliderMoved(start, end float32)
slider moved along relevant axis
func (*SliderBase) SliderPressed ¶
func (g *SliderBase) SliderPressed(pos float32)
set the slider in the down state -- mouse clicked down but not yet up -- emits SliderPressed signal
func (*SliderBase) SliderReleased ¶
func (g *SliderBase) SliderReleased()
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 (g *SliderBase) SnapValue()
if snap is set, then snap the value to step sizes
func (*SliderBase) UpdatePosFromValue ¶
func (g *SliderBase) UpdatePosFromValue()
func (*SliderBase) UpdateThumbValSize ¶
func (g *SliderBase) UpdateThumbValSize()
set thumb size as proportion of min / max (e.g., amount visible in scrollbar) -- max's out to full size
type SliderSignals ¶
type SliderSignals int64
signals that sliders can send
const ( // value has changed -- if tracking is enabled, then this tracks online changes -- otherwise only at the end SliderValueChanged SliderSignals = iota // slider pushed down but not yet up SliderPressed SliderReleased 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
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 SolidcolorPaintServer ¶
Solid PaintServer
func (*SolidcolorPaintServer) ColorAt ¶
func (p *SolidcolorPaintServer) ColorAt(x, y int) color.Color
func (*SolidcolorPaintServer) ServerType ¶
func (p *SolidcolorPaintServer) ServerType() PaintServers
type Space ¶
type Space struct {
Node2DBase
}
Space adds a fixed sized (1 em by default) blank space to a layout -- set width / height property to change
type SpinBox ¶
type SpinBox struct { WidgetBase 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 */ UpIcon *Icon `json:"-" xml:"-" desc:"icon to use for up button -- defaults to widget-wedge-up"` DownIcon *Icon `json:"-" xml:"-" desc:"icon to use for down button -- defaults to widget-wedge-down"` SpinBoxSig ki.Signal `json:"-" xml:"-" 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 (*SpinBox) ConfigParts ¶
func (g *SpinBox) ConfigParts()
func (*SpinBox) ConfigPartsIfNeeded ¶
func (g *SpinBox) ConfigPartsIfNeeded()
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) SetValueAction ¶
SetValueAction calls SetValue and also emits the signal
type SplitView ¶
type SplitView struct { WidgetBase 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 Dims2D `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 necesssary). 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 indpendently 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 (*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 (g *SplitView) ConfigSplitters()
func (*SplitView) ReRender2D ¶
func (*SplitView) RestoreSplits ¶
func (g *SplitView) RestoreSplits()
RestoreSplits restores a previously-saved set of splits (if it exists), does an update
func (*SplitView) SaveSplits ¶
func (g *SplitView) SaveSplits()
SaveSplits saves the current set of splits in SavedSplits, for a later RestoreSplits
func (*SplitView) SetSplits ¶
SetSplits sets the split proportions -- can use 0 to hide / collapse a child entirely -- does an Update
func (*SplitView) SetSplitsAction ¶
func (*SplitView) UpdateSplits ¶
func (g *SplitView) UpdateSplits()
UpdateSplits updates the splits to be same length as number of children, and normalized
type Splitter ¶
type Splitter struct {
SliderBase
}
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) FocusChanged2D ¶
func (*Splitter) ReRender2D ¶
func (*Splitter) Render2DDefaultStyle ¶
func (g *Splitter) Render2DDefaultStyle()
render using a default style if not otherwise styled
type Stretch ¶
type Stretch struct {
Node2DBase
}
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
type StrokeStyle ¶
type StrokeStyle struct { On bool `desc:"is stroke active -- if property is none then false"` Color Color `xml:"stroke" desc:"default stroke color when such a color is needed -- Server could be anything"` Opacity float32 `xml:"stroke-opacity" desc:"global alpha opacity / transparency factor"` Server PaintServer `view:"-" desc:"paint server for the stroke -- if solid color, defines the stroke color"` Width units.Value `xml:"stroke-width" desc:"line width"` Dashes []float32 `xml:"stroke-dasharray" desc:"dash pattern"` Cap LineCap `xml:"stroke-linecap" desc:"how to draw the end cap of lines"` Join LineJoin `xml:"stroke-linejoin" desc:"how to join line segments"` MiterLimit float32 `xml:"stroke-miterlimit,min:"1" desc:"limit of how far to miter -- must be 1 or larger"` }
StrokeStyle contains all the properties specific to painting a line -- the svg elements define the corresponding SVG style attributes, which are processed in StrokeStyle
func (*StrokeStyle) Defaults ¶
func (ps *StrokeStyle) Defaults()
initialize default values for paint stroke
func (*StrokeStyle) SetColor ¶
func (ps *StrokeStyle) SetColor(cl *Color)
func (*StrokeStyle) SetStylePost ¶
func (ps *StrokeStyle) SetStylePost()
need to do some updating after setting the style from user properties
type StructInlineValueView ¶
type StructInlineValueView struct {
ValueViewBase
}
StructInlineValueView presents a StructViewInline for a struct
func (*StructInlineValueView) ConfigWidget ¶
func (vv *StructInlineValueView) ConfigWidget(widg Node2D)
func (*StructInlineValueView) New ¶
func (n *StructInlineValueView) New() ki.Ki
func (*StructInlineValueView) UpdateWidget ¶
func (vv *StructInlineValueView) UpdateWidget()
func (*StructInlineValueView) WidgetType ¶
func (vv *StructInlineValueView) WidgetType() reflect.Type
type StructValueView ¶
type StructValueView struct {
ValueViewBase
}
StructValueView presents a button to edit slices
func (*StructValueView) ConfigWidget ¶
func (vv *StructValueView) ConfigWidget(widg Node2D)
func (*StructValueView) New ¶
func (n *StructValueView) New() ki.Ki
func (*StructValueView) UpdateWidget ¶
func (vv *StructValueView) UpdateWidget()
func (*StructValueView) WidgetType ¶
func (vv *StructValueView) WidgetType() reflect.Type
type StructView ¶
type StructView struct { Frame Struct interface{} `desc:"the struct that we are a view onto"` Title string `desc:"title / prompt to show above the editor fields"` FieldViews []ValueView `json:"-" xml:"-" desc:"ValueView representations of the fields"` TmpSave ValueView `` /* 189-byte string literal not displayed */ ViewSig ki.Signal `` /* 179-byte string literal not displayed */ }
StructView represents a struct, creating a property editor of the fields -- constructs Children widgets to show the field names and editor fields for each field, within an overall frame with an optional title, and a button box at the bottom where methods can be invoked
func (*StructView) ButtonBox ¶
func (sv *StructView) ButtonBox() (*Layout, int)
ButtonBox returns the ButtonBox layout widget, and its index, within frame -- nil, -1 if not found
func (*StructView) ConfigStructGrid ¶
func (sv *StructView) ConfigStructGrid()
ConfigStructGrid configures the StructGrid for the current struct
func (*StructView) New ¶
func (n *StructView) New() ki.Ki
func (*StructView) ReRender2D ¶
func (sv *StructView) ReRender2D() (node Node2D, layout bool)
func (*StructView) Render2D ¶
func (sv *StructView) Render2D()
func (*StructView) SetStruct ¶
func (sv *StructView) SetStruct(st interface{}, tmpSave ValueView)
SetStruct sets the source struct that we are viewing -- rebuilds the children to represent this struct
func (*StructView) SetTitle ¶
func (sv *StructView) SetTitle(title string)
SetTitle sets the title and updates the Title label
func (*StructView) StdConfig ¶
func (sv *StructView) StdConfig() (mods, updt bool)
StdConfig configures a standard setup of the overall Frame -- returns mods, updt from ConfigChildren and does NOT call UpdateEnd
func (*StructView) StdFrameConfig ¶
func (sv *StructView) StdFrameConfig() kit.TypeAndNameList
StdFrameConfig returns a TypeAndNameList for configuring a standard Frame -- can modify as desired before calling ConfigChildren on Frame using this
func (*StructView) StructGrid ¶
func (sv *StructView) StructGrid() (*Layout, int)
StructGrid returns the grid layout widget, which contains all the fields and values, and its index, within frame -- nil, -1 if not found
func (*StructView) Style2D ¶
func (sv *StructView) Style2D()
func (*StructView) TitleWidget ¶
func (sv *StructView) TitleWidget() (*Label, int)
Title returns the title label widget, and its index, within frame -- nil, -1 if not found
func (*StructView) UpdateFields ¶
func (sv *StructView) UpdateFields()
func (*StructView) UpdateFromStruct ¶
func (sv *StructView) UpdateFromStruct()
type StructViewInline ¶
type StructViewInline struct { WidgetBase Struct interface{} `desc:"the struct that we are a view onto"` AddAction bool `` /* 135-byte string literal not displayed */ FieldViews []ValueView `json:"-" xml:"-" desc:"ValueView representations of the fields"` TmpSave ValueView `` /* 189-byte string literal not displayed */ ViewSig ki.Signal `` /* 179-byte string literal not displayed */ }
StructViewInline represents a struct as a single line widget, for smaller structs and those explicitly marked inline in the kit type registry type properties -- constructs widgets in Parts to show the field names and editor fields for each field
func (*StructViewInline) ConfigParts ¶
func (sv *StructViewInline) ConfigParts()
ConfigParts configures Parts for the current struct
func (*StructViewInline) New ¶
func (n *StructViewInline) New() ki.Ki
func (*StructViewInline) ReRender2D ¶
func (sv *StructViewInline) ReRender2D() (node Node2D, layout bool)
func (*StructViewInline) Render2D ¶
func (sv *StructViewInline) Render2D()
func (*StructViewInline) SetStruct ¶
func (sv *StructViewInline) SetStruct(st interface{}, tmpSave ValueView)
SetStruct sets the source struct that we are viewing -- rebuilds the children to represent this struct
func (*StructViewInline) UpdateFields ¶
func (sv *StructViewInline) UpdateFields()
func (*StructViewInline) UpdateFromStruct ¶
func (sv *StructViewInline) UpdateFromStruct()
type Style ¶
type Style struct { 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"` Display bool `xml:"display" desc:"todo big enum of how to display item -- controls layout etc"` Visible bool `xml:"visible" desc:"todo big enum of how to display item -- controls layout etc"` 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:"type of shadow to render around box"` Font FontStyle `xml:"font" desc:"font parameters"` Text TextStyle `desc:"text parameters -- no xml prefix"` Color Color `xml:"color" inherit:"true" desc:"text color"` Background BackgroundStyle `xml:"background" desc:"background settings"` Opacity float32 `xml:"opacity" desc:"alpha value to apply to all elements"` Outline BorderStyle `xml:"outline" desc:"draw an outline around an element -- mostly same styles as border -- default to none"` PointerEvents bool `xml:"pointer-events" desc:"does this element respond to pointer events -- default is true"` UnContext units.Context `xml:"-" desc:"units context -- parameters necessary for anchoring relative units"` // 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) 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) SetStyle ¶
SetStyle 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 Vec2D)
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
type StyledField ¶
type StyledField struct { Field reflect.StructField NetOff uintptr `desc:"net accumulated offset from the overall main type, e.g., Style"` Default reflect.Value `desc:"value of default value of this field"` }
StyledField contains the relevant data for a given stylable field in a struct
func (*StyledField) FieldIface ¶
func (sf *StyledField) FieldIface(obj interface{}) interface{}
FieldIface returns an interface{} for a given object, computed from NetOff -- much faster -- use this
func (*StyledField) FieldValue ¶
func (sf *StyledField) FieldValue(obj interface{}) reflect.Value
FieldValue returns a reflect.Value for a given object, computed from NetOff -- this is VERY expensive time-wise -- need to figure out a better solution..
func (*StyledField) FromProps ¶
func (fld *StyledField) FromProps(fields map[string]*StyledField, obj, par, val interface{}, hasPar bool)
FromProps styles given field from property value val, with optional parent object obj
func (*StyledField) UnitsValue ¶
func (sf *StyledField) UnitsValue(obj interface{}) *units.Value
UnitsValue returns a units.Value for a field, which must be of that type..
type StyledFields ¶
type StyledFields struct { Fields map[string]*StyledField `desc:"the compiled stylable fields, mapped for the xml and alt tags for the field"` Inherits []*StyledField `desc:"the compiled stylable fields that have inherit:"true" tags and should thus be inherited from parent objects"` Units []*StyledField `desc:"the compiled stylable fields of the unit.Value type, which should have ToDots run on them"` Default interface{} `desc:"points to the Default instance of this type, initialized with the default values used for 'initial' keyword"` }
StyledFields contains fields of a struct that are styled -- create one instance of this for each type that has styled fields (Style, Paint, and a few with ad-hoc styled fields)
func (*StyledFields) AddField ¶
func (sf *StyledFields) AddField(def interface{}, fieldName string) error
AddField adds a single field -- must be a direct field on the object and not a field on an embedded type -- used for Widget objects where only one or a few fields are styled
func (*StyledFields) CompileFields ¶
func (sf *StyledFields) CompileFields(def interface{})
CompileFields gathers all the fields with xml tag != "-", plus those that are units.Value's for later optimized processing of styles
func (*StyledFields) Inherit ¶
func (sf *StyledFields) Inherit(obj, par interface{})
Inherit copies all the values from par to obj for fields marked as "inherit" -- inherited by default
func (*StyledFields) Init ¶
func (sf *StyledFields) Init(def interface{})
func (*StyledFields) Style ¶
func (sf *StyledFields) Style(obj, par interface{}, props ki.Props)
Style applies styles to the fields from given properties for given object
func (*StyledFields) ToDots ¶
func (sf *StyledFields) ToDots(obj interface{}, uc *units.Context)
ToDots runs ToDots on unit values, to compile down to raw pixels
type TabView ¶
type TabView struct { WidgetBase SrcNode ki.Ptr `` /* 132-byte string literal not displayed */ TabViewSig ki.Signal `json:"-" xml:"-" desc:"signal for tab widget -- see TabViewSignals for the types"` }
TabView represents children of a source node as tabs with a stacked layout of Frame widgets for each child in the source -- we create a LayoutCol with a LayoutRow of tab buttons and then the LayoutStacked of Frames
func (*TabView) InitTabView ¶
func (g *TabView) InitTabView()
initialize the tab widget structure -- assumes it has been done if there is already a child node
func (*TabView) SelectTabIndex ¶
select tab at given index
func (*TabView) SetSrcNode ¶
set the source Ki Node that generates our tabs
func (*TabView) TabColLayout ¶
get the overal column layout for the tab widget
func (*TabView) TabFrameAtIndex ¶
get tab frame for given index
func (*TabView) TabRowLayout ¶
get the row layout of tabs across the top of the tab widget
func (*TabView) TabStackLayout ¶
get the stacked layout of tab frames
type TabViewSignals ¶
type TabViewSignals int64
signals that buttons can send
const ( // node was selected -- data is the tab widget TabSelected TabViewSignals = iota // tab widget unselected TabUnselected // collapsed tab widget was opened TabOpened // open tab widget was collapsed -- children not visible TabCollapsed TabViewSignalsN )
func (*TabViewSignals) FromString ¶
func (i *TabViewSignals) FromString(s string) error
func (TabViewSignals) String ¶
func (i TabViewSignals) String() string
type Text2D ¶
type Text2D struct { Node2DBase Pos Vec2D `xml:"{x,y}" desc:"position of the left, baseline of the text"` Width float32 `xml:"width" desc:"width of text to render if using word-wrapping"` Text string `xml:"text" desc:"text string to render"` WrappedText []string `json:"-" xml:"-" "desc:word-wrapped version of the string"` }
2D Text
func (*Text2D) ReRender2D ¶
type TextField ¶
type TextField struct { WidgetBase Text string `json:"-" xml:"text" desc:"the last saved value of the text string being edited"` EditText string `json:"-" xml:"-" desc:"the live text string being edited, with latest modifications"` StartPos int `xml:"start-pos" desc:"starting display position in the string"` EndPos int `xml:"end-pos" desc:"ending display position in the string"` CursorPos int `xml:"cursor-pos" desc:"current cursor position"` CharWidth int `xml:"char-width" desc:"approximate number of chars that can be displayed at any time -- computed from font size etc"` SelectMode bool `xml:"select-mode" desc:"if true, select text as cursor moves"` TextFieldSig ki.Signal `json:"-" xml:"-" desc:"signal for line edit -- see TextFieldSignals for the types"` StateStyles [TextFieldStatesN]Style `json:"-" xml:"-" desc:"normal style and focus style"` CharPos []float32 `` /* 151-byte string literal not displayed */ // contains filtered or unexported fields }
TextField is a widget for editing a line of text
func (*TextField) AutoScroll ¶
func (g *TextField) AutoScroll()
AutoScroll scrolls the starting position to keep the cursor visible
func (*TextField) CursorBackspace ¶
func (*TextField) CursorBackward ¶
func (*TextField) CursorDelete ¶
func (*TextField) CursorForward ¶
func (*TextField) CursorKill ¶
func (g *TextField) CursorKill()
func (*TextField) CursorStart ¶
func (g *TextField) CursorStart()
func (*TextField) EditDone ¶
func (g *TextField) EditDone()
done editing: return key pressed or out of focus
func (*TextField) FocusChanged2D ¶
func (*TextField) InsertAtCursor ¶
func (*TextField) KeyInput ¶
func (g *TextField) KeyInput(kt *key.ChordEvent)
func (*TextField) PixelToCursor ¶
PixelToCursor finds the cursor position that corresponds to the given pixel location
func (*TextField) RenderCursor ¶
func (g *TextField) RenderCursor()
func (*TextField) RevertEdit ¶
func (g *TextField) RevertEdit()
abort editing -- revert to last saved text
func (*TextField) SetCursorFromPixel ¶
func (*TextField) StartCharPos ¶
StartCharPos returns the starting position of the given character -- CharPos contains the ending positions
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) UpdateCharPos ¶
type TextFieldSignals ¶
type TextFieldSignals int64
signals that buttons can send
const ( // main signal -- return was pressed and an edit was completed -- data is the text TextFieldDone TextFieldSignals = iota TextFieldSignalsN )
func (*TextFieldSignals) FromString ¶
func (i *TextFieldSignals) FromString(s string) error
func (TextFieldSignals) String ¶
func (i TextFieldSignals) String() string
type TextFieldStates ¶
type TextFieldStates int32
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 TextFieldStatesN )
func (*TextFieldStates) FromString ¶
func (i *TextFieldStates) FromString(s string) error
func (TextFieldStates) String ¶
func (i TextFieldStates) String() string
type TextStyle ¶
type TextStyle struct { Align Align `xml:"text-align" inherit:"true" desc:"how to align text"` AlignV Align `xml:"-" json:"-" desc:"vertical alignment of text -- copied from layout style AlignV"` LineHeight float32 `` /* 185-byte string literal not displayed */ LetterSpacing units.Value `xml:"letter-spacing" desc:"spacing between characters and lines"` Indent units.Value `xml:"text-indent" inherit:"true" desc:"how much to indent the first line in a paragraph"` TabSize units.Value `xml:"tab-size" inherit:"true" desc:"tab size"` WordSpacing units.Value `xml:"word-spacing" inherit:"true" desc:"extra space to add between words"` WordWrap bool `xml:"word-wrap" inherit:"true" desc:"wrap text within a given size"` }
all the style information associated with how to render text
func (*TextStyle) AlignFactors ¶
get basic text alignment factors for DrawString routines -- does not handle justified
func (*TextStyle) EffLineHeight ¶
effective line height (taking into account 0 value)
func (*TextStyle) SetStylePost ¶
func (p *TextStyle) SetStylePost()
any updates after generic xml-tag property setting?
type Transform3D ¶
type Transform3D struct { Transform mgl32.Mat4 // overall compiled transform Scale mgl32.Vec3 Translation mgl32.Vec3 Orientation mgl32.Quat }
3D transform
type TreeView ¶
type TreeView struct { WidgetBase SrcNode ki.Ptr `desc:"Ki Node that this widget is viewing in the tree -- the source"` Indent units.Value `xml:"indent" desc:"styled amount to indent children relative to this node"` TreeViewSig ki.Signal `` /* 157-byte string literal not displayed */ StateStyles [TreeViewStatesN]Style `` /* 217-byte string literal not displayed */ WidgetSize Vec2D `desc:"just the size of our widget -- our alloc includes all of our children, but we only draw us"` Icon *Icon `json:"-" xml:"-" desc:"optional icon, displayed to the the left of the text label"` RootWidget *TreeView `json:"-" xml:"-" view:"-" desc:"cached root widget"` }
TreeView represents one node in the tree -- fully recursive -- creates
sub-nodes
var TreeViewDefault TreeView
TreeViewDefault is default obj that can be used when property specifies "default"
func (*TreeView) ChildrenBBox2D ¶
func (*TreeView) ClearSelectMods ¶
func (tv *TreeView) ClearSelectMods()
func (*TreeView) ConfigParts ¶
func (tv *TreeView) ConfigParts()
func (*TreeView) ConfigPartsIfNeeded ¶
func (tv *TreeView) ConfigPartsIfNeeded()
func (*TreeView) FocusChanged2D ¶
func (*TreeView) HasClosedParent ¶
does this node have a closed parent? if so, don't render!
func (*TreeView) Layout2DParts ¶
func (*TreeView) MakeMenu ¶
func (tv *TreeView) MakeMenu(mb *ButtonBase)
func (*TreeView) MoveDownSibling ¶
func (tv *TreeView) MoveDownSibling()
move down only to siblings, not down into children
func (*TreeView) MoveToLastChild ¶
func (tv *TreeView) MoveToLastChild()
move up to the last child under me
func (*TreeView) ReRender2D ¶
func (*TreeView) RootTreeView ¶
root node of TreeView tree -- several properties stored there
func (*TreeView) RootUnselectAll ¶
func (tv *TreeView) RootUnselectAll()
unselect everything below me -- call on Root to clear all
func (*TreeView) SelectAction ¶
func (tv *TreeView) SelectAction()
a select action has been received (e.g., a mouse click) -- translate into selection updates
func (*TreeView) SelectedSrcNodes ¶
return a list of the currently-selected source nodes
func (*TreeView) SelectedTreeViews ¶
return a list of the currently-selected TreeViews
func (*TreeView) SetClosedState ¶
func (*TreeView) SetContinuousSelect ¶
func (tv *TreeView) SetContinuousSelect()
func (*TreeView) SetExtendSelect ¶
func (tv *TreeView) SetExtendSelect()
func (*TreeView) SetSrcNode ¶
set the source node that we are viewing
func (*TreeView) SrcAddChild ¶
func (tv *TreeView) SrcAddChild()
add a new child node in the source tree
func (*TreeView) SrcDuplicate ¶
func (tv *TreeView) SrcDuplicate()
duplicate item in source tree, add after
func (*TreeView) SrcInsertAfter ¶
func (tv *TreeView) SrcInsertAfter()
insert a new node in the source tree
func (*TreeView) SrcInsertBefore ¶
func (tv *TreeView) SrcInsertBefore()
insert a new node in the source tree
func (*TreeView) ToggleClose ¶
func (tv *TreeView) ToggleClose()
func (*TreeView) UnselectAll ¶
func (tv *TreeView) UnselectAll()
unselect everything below me -- call on Root to clear all
type TreeViewSignals ¶
type TreeViewSignals int64
signals that treeview can send -- these are all sent from the root tree view widget node, with data being the relevant node widget
const ( // node was selected TreeViewSelected TreeViewSignals = iota // TreeView unselected TreeViewUnselected // closed TreeView was opened TreeViewOpened // open TreeView was closed -- children not visible TreeViewClosed TreeViewSignalsN )
func (*TreeViewSignals) FromString ¶
func (i *TreeViewSignals) FromString(s string) error
func (TreeViewSignals) String ¶
func (i TreeViewSignals) String() string
type TreeViewStates ¶
type TreeViewStates int32
mutually-exclusive tree view states -- determines appearance
const ( // normal state -- there but not being interacted with TreeViewActive TreeViewStates = iota // selected TreeViewSel // in focus -- will respond to keyboard input TreeViewFocus TreeViewStatesN )
func (*TreeViewStates) FromString ¶
func (i *TreeViewStates) FromString(s string) error
func (TreeViewStates) String ¶
func (i TreeViewStates) String() string
type TypeValueView ¶
type TypeValueView struct {
ValueViewBase
}
TypeValueView presents a combobox for choosing types
func (*TypeValueView) ConfigWidget ¶
func (vv *TypeValueView) ConfigWidget(widg Node2D)
func (*TypeValueView) New ¶
func (n *TypeValueView) New() ki.Ki
func (*TypeValueView) UpdateWidget ¶
func (vv *TypeValueView) UpdateWidget()
func (*TypeValueView) WidgetType ¶
func (vv *TypeValueView) WidgetType() reflect.Type
type ValueView ¶
type ValueView interface { ki.Ki // AsValueViewBase gives access to the basic data fields so that the // interface doesn't need to provide accessors for them AsValueViewBase() *ValueViewBase // SetStructValue sets the value, owner and field information for a struct field SetStructValue(val reflect.Value, owner interface{}, field *reflect.StructField, tmpSave ValueView) // SetMapKey sets the key value and owner for a map key SetMapKey(val reflect.Value, owner interface{}, tmpSave ValueView) // SetMapValue sets the value, owner and map key information for a map // element -- needs pointer to ValueView representation of key to track // current key value SetMapValue(val reflect.Value, owner interface{}, key interface{}, keyView ValueView, tmpSave ValueView) // SetSliceValue sets the value, owner and index information for a slice element SetSliceValue(val reflect.Value, owner interface{}, idx int, tmpSave ValueView) // OwnerKind returns the reflect.Kind of the owner: Struct, Map, or Slice OwnerKind() reflect.Kind // IsInactive returns whether the value is inactive -- e.g., Map owners // have Inactive values, and some fields can be marked as Inactive using a // struct tag IsInactive() bool // WidgetType returns an appropriate type of widget to represent the current value WidgetType() reflect.Type // UpdateWidget updates the widget representation to reflect the current value UpdateWidget() // ConfigWidget configures a widget of WidgetType for representing the // value, including setting up the signal connections to set the value // when the user edits it (values are always set immediately when the // widget is updated) ConfigWidget(widg Node2D) // Val returns the reflect.Value representation for this item Val() reflect.Value // SetValue sets the value (if not Inactive), using Ki.SetField for Ki // types and kit.SetRobust otherwise -- emits a ViewSig signal when set SetValue(val interface{}) bool // ViewFieldTag returns tag associated with this field, if this is a field // in a struct ("" otherwise or if tag not set) ViewFieldTag(tagName string) string // SaveTmp saves a temporary copy of a struct to a map -- map values must // be explicitly re-saved and cannot be directly written to by the value // elements -- each ValueView has a pointer to any parent ValueView that // might need to be saved after SetValue -- SaveTmp called automatically // in SetValue but other cases that use something different need to call // it explicitly SaveTmp() }
ValueView is an interface for representing values (e.g., fields, map values, slice values) in Views (StructView, MapView, etc) -- the different types of ValueView are for different Kinds of values (bool, float, etc) -- which can have different Kinds of owners -- the ValueVuewBase class supports all the basic fields for managing the owner kinds
func FieldToValueView ¶
FieldToValueView returns the appropriate ValueView for given field on a struct -- attempts to get the FieldValueViewer interface, and falls back on ToValueView otherwise, using field value (fval)
func ToValueView ¶
func ToValueView(it interface{}) ValueView
ToValueView returns the appropriate ValueView for given item, based only on its type -- attempts to get the ValueViewer interface and failing that, falls back on default Kind-based options -- see FieldToValueView, MapToValueView, SliceToValue view for versions that take into account the properties of the owner (used in those appropriate contexts)
type ValueViewBase ¶
type ValueViewBase struct { ki.Node ViewSig ki.Signal `` /* 213-byte string literal not displayed */ Value reflect.Value `desc:"the reflect.Value representation of the value"` OwnKind reflect.Kind `desc:"kind of owner that we have -- reflect.Struct, .Map, .Slice are supported"` IsMapKey bool `desc:"for OwnKind = Map, this value represents the Key -- otherwise the Value"` Owner interface{} `` /* 162-byte string literal not displayed */ OwnerType reflect.Type `desc:"non-pointer type of the Owner, for convenience"` Field *reflect.StructField `desc:"if Owner is a struct, this is the reflect.StructField associated with the value"` Key interface{} `desc:"if Owner is a map, and this is a value, this is the key for this value in the map"` KeyView ValueView `` /* 159-byte string literal not displayed */ Idx int `desc:"if Owner is a slice, this is the index for the value in the slice"` WidgetTyp reflect.Type `` /* 156-byte string literal not displayed */ Widget Node2D `` /* 142-byte string literal not displayed */ Label string `desc:"label for displaying this item -- based on Field.Name and optional label Tag value"` TmpSave ValueView `` /* 172-byte string literal not displayed */ }
ValueViewBase provides the basis for implementations of the ValueView interface, representing values in the interface -- it implements a generic TextField representation of the string value, and provides the generic fallback for everything that doesn't provide a specific ValueViewer type
func (*ValueViewBase) AsValueViewBase ¶
func (vv *ValueViewBase) AsValueViewBase() *ValueViewBase
func (*ValueViewBase) ConfigWidget ¶
func (vv *ValueViewBase) ConfigWidget(widg Node2D)
func (*ValueViewBase) CreateTempIfNotPtr ¶
func (vv *ValueViewBase) CreateTempIfNotPtr() bool
func (*ValueViewBase) IsInactive ¶
func (vv *ValueViewBase) IsInactive() bool
func (*ValueViewBase) New ¶
func (n *ValueViewBase) New() ki.Ki
func (*ValueViewBase) OwnerKind ¶
func (vv *ValueViewBase) OwnerKind() reflect.Kind
we have this one accessor b/c it is more useful for outside consumers vs. internal usage
func (*ValueViewBase) SaveTmp ¶
func (vv *ValueViewBase) SaveTmp()
func (*ValueViewBase) SetMapKey ¶
func (vv *ValueViewBase) SetMapKey(key reflect.Value, owner interface{}, tmpSave ValueView)
func (*ValueViewBase) SetMapValue ¶
func (vv *ValueViewBase) SetMapValue(val reflect.Value, owner interface{}, key interface{}, keyView ValueView, tmpSave ValueView)
func (*ValueViewBase) SetSliceValue ¶
func (vv *ValueViewBase) SetSliceValue(val reflect.Value, owner interface{}, idx int, tmpSave ValueView)
func (*ValueViewBase) SetStructValue ¶
func (vv *ValueViewBase) SetStructValue(val reflect.Value, owner interface{}, field *reflect.StructField, tmpSave ValueView)
func (*ValueViewBase) SetValue ¶
func (vv *ValueViewBase) SetValue(val interface{}) bool
func (*ValueViewBase) UpdateWidget ¶
func (vv *ValueViewBase) UpdateWidget()
func (*ValueViewBase) Val ¶
func (vv *ValueViewBase) Val() reflect.Value
func (*ValueViewBase) ViewFieldTag ¶
func (vv *ValueViewBase) ViewFieldTag(tagName string) string
func (*ValueViewBase) WidgetType ¶
func (vv *ValueViewBase) WidgetType() reflect.Type
type ValueViewer ¶
type ValueViewer interface {
ValueView() ValueView
}
ValueViewer interface supplies the appropriate type of ValueView -- called on a given receiver item if defined for that receiver type (tries both pointer and non-pointer receivers) -- can use this for custom types to provide alternative custom interfaces
type Vec2D ¶
type Vec2D struct {
X, Y float32
}
2D vector -- a point or size in 2D
func CubicBezier ¶
func NewVec2DFmPoint ¶
func PathDataMinMax ¶
PathDataMinMax traverses the path data and extracts the min and max point coords
func QuadraticBezier ¶
func (*Vec2D) SetDivlVal ¶
func (*Vec2D) SetMinPosDim ¶
set the value along a given dimension to min of current val and new val
func (*Vec2D) SetMinPosVal ¶
set to minpos of current value and val
func (Vec2D) ToPointCeil ¶
func (Vec2D) ToPointFloor ¶
func (Vec2D) ToPointRound ¶
type ViewBox2D ¶
type ViewBox2D struct { Min image.Point `svg:"{min-x,min-y}" desc:"offset or starting point in parent Viewport2D"` Size image.Point `svg:"{width,height}" desc:"size of viewbox within parent Viewport2D"` PreserveAspectRatio ViewBoxPreserveAspectRatio `svg:"preserveAspectRatio" desc:"how to scale the view box within parent Viewport2D"` }
ViewBox defines a region in 2D bitmap image space -- it must ALWAYS be in terms of underlying pixels
type ViewBoxAlign ¶
type ViewBoxAlign int32
ViewBoxAlign defines values for the PreserveAspectRatio alignment factor
const ( None ViewBoxAlign = 1 << iota // do not preserve uniform scaling XMin // align ViewBox.Min with smallest values of Viewport XMid // align ViewBox.Min with midpoint values of Viewport XMax // align ViewBox.Min+Size with maximum values of Viewport XMask ViewBoxAlign = XMin + XMid + XMax // mask for X values -- clear all X before setting new one YMin ViewBoxAlign = 1 << iota // align ViewBox.Min with smallest values of Viewport YMid // align ViewBox.Min with midpoint values of Viewport YMax // align ViewBox.Min+Size with maximum values of Viewport YMask ViewBoxAlign = YMin + YMid + YMax // mask for Y values -- clear all Y before setting new one )
type ViewBoxMeetOrSlice ¶
type ViewBoxMeetOrSlice int32
ViewBoxMeetOrSlice defines values for the PreserveAspectRatio meet or slice factor
const ( Meet ViewBoxMeetOrSlice = iota // the entire ViewBox is visible within Viewport, and it is scaled up as much as possible to meet the align constraints Slice ViewBoxMeetOrSlice = iota // the entire ViewBox is covered by the ViewBox, and the ViewBox is scaled down as much as possible, while still meeting the align constraints )
func (*ViewBoxMeetOrSlice) FromString ¶
func (i *ViewBoxMeetOrSlice) FromString(s string) error
func (ViewBoxMeetOrSlice) String ¶
func (i ViewBoxMeetOrSlice) String() string
type ViewBoxPreserveAspectRatio ¶
type ViewBoxPreserveAspectRatio struct { Align ViewBoxAlign `svg:"align" desc:"how to align x,y coordinates within viewbox"` MeetOrSlice ViewBoxMeetOrSlice `svg:"meetOrSlice" desc:"how to scale the view box relative to the viewport"` }
ViewBoxPreserveAspectRatio determines how to scale the view box within parent Viewport2D
type Viewport2D ¶
type Viewport2D struct { Node2DBase CSS ki.Props `` /* 191-byte string literal not displayed */ CSSAgg ki.Props `json:"-" xml:"-" desc:"aggregated css properties from all higher nodes down to me"` Fill bool `desc:"fill the viewport with background-color from style"` ViewBox ViewBox2D `xml:"viewBox" desc:"viewbox within any parent Viewport2D"` Render RenderState `json:"-" xml:"-" view:"-" desc:"render state for rendering"` Pixels *image.RGBA `json:"-" xml:"-" view:"-" desc:"live pixels that we render into, from OSImage"` OSImage oswin.Image `json:"-" xml:"-" view:"-" desc:"the oswin.Image that owns our pixels"` Win *Window `json:"-" xml:"-" desc:"our parent window that we render into"` }
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 OSImage with the specified width and height, and intializes the renderer etc
func PopupMenu ¶
func PopupMenu(menu ki.Slice, x, y int, parVp *Viewport2D, name string) *Viewport2D
PopupMenu just 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 (*Viewport2D) AsViewport2D ¶
func (vp *Viewport2D) AsViewport2D() *Viewport2D
func (*Viewport2D) BBox2D ¶
func (vp *Viewport2D) BBox2D() image.Rectangle
func (*Viewport2D) CSSProps ¶
func (g *Viewport2D) CSSProps() (css, agg *ki.Props)
func (*Viewport2D) ChildrenBBox2D ¶
func (vp *Viewport2D) ChildrenBBox2D() image.Rectangle
func (*Viewport2D) ComputeBBox2D ¶
func (vp *Viewport2D) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)
func (*Viewport2D) DeletePopup ¶
func (vp *Viewport2D) DeletePopup()
Delete this 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)
draw our image into parents -- called at right place in Render
func (*Viewport2D) DrawIntoWindow ¶
func (vp *Viewport2D) DrawIntoWindow()
draw a vp into window directly -- for most non-main vp's
func (*Viewport2D) DrawMainViewport ¶
func (vp *Viewport2D) DrawMainViewport()
draw main viewport into window -- needs to redraw popups over top of it, so does a full update
func (*Viewport2D) DrawMainVpOverMe ¶
func (vp *Viewport2D) DrawMainVpOverMe()
draw main window vp into region of this vp
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) FocusChanged2D ¶
func (g *Viewport2D) FocusChanged2D(gotFocus bool)
func (*Viewport2D) Init2D ¶
func (vp *Viewport2D) Init2D()
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) Layout2D ¶
func (vp *Viewport2D) Layout2D(parBBox image.Rectangle)
func (*Viewport2D) Move2D ¶
func (vp *Viewport2D) Move2D(delta image.Point, parBBox image.Rectangle)
func (*Viewport2D) New ¶
func (n *Viewport2D) New() ki.Ki
func (*Viewport2D) PopBounds ¶
func (vp *Viewport2D) PopBounds()
func (*Viewport2D) PushBounds ¶
func (vp *Viewport2D) PushBounds() bool
we use our own render for these -- Viewport member is our parent!
func (*Viewport2D) ReRender2D ¶
func (vp *Viewport2D) ReRender2D() (node Node2D, layout bool)
func (*Viewport2D) ReRender2DAnchor ¶
func (vp *Viewport2D) ReRender2DAnchor(gni Node2D)
re-render a specific node that has said it can re-render
func (*Viewport2D) ReRender2DNode ¶
func (vp *Viewport2D) ReRender2DNode(gni Node2D)
re-render a specific node that has said it can re-render
func (*Viewport2D) Render2D ¶
func (vp *Viewport2D) Render2D()
func (*Viewport2D) RenderViewport2D ¶
func (vp *Viewport2D) RenderViewport2D()
func (*Viewport2D) Resize ¶
func (vp *Viewport2D) Resize(width, height int)
Resize resizes the viewport, creating a new image (no point in trying to resize the image -- need to re-render) -- updates ViewBox Size too -- triggers update -- wrap in other UpdateStart/End calls as appropriate
func (*Viewport2D) SavePNG ¶
func (vp *Viewport2D) SavePNG(path string) error
SavePNG encodes the image as a PNG and writes it to disk.
func (*Viewport2D) SetCurWin ¶
func (vp *Viewport2D) SetCurWin()
set our window pointer to point to the current window we are under
func (*Viewport2D) Size2D ¶
func (vp *Viewport2D) Size2D()
func (*Viewport2D) Style2D ¶
func (vp *Viewport2D) Style2D()
func (*Viewport2D) StyleCSS ¶
func (g *Viewport2D) StyleCSS(node Node2D)
type Viewport2DFill ¶
type Viewport2DFill struct {
Rect
}
viewport fill fills entire viewport -- just a rect that automatically sets size to viewport
func (*Viewport2DFill) BBox2D ¶
func (g *Viewport2DFill) BBox2D() image.Rectangle
func (*Viewport2DFill) Init2D ¶
func (g *Viewport2DFill) Init2D()
func (*Viewport2DFill) New ¶
func (n *Viewport2DFill) New() ki.Ki
func (*Viewport2DFill) ReRender2D ¶
func (g *Viewport2DFill) ReRender2D() (node Node2D, layout bool)
func (*Viewport2DFill) Style2D ¶
func (g *Viewport2DFill) Style2D()
type WalkStyleFieldFunc ¶
type WalkStyleFieldFunc func(struf reflect.StructField, vf reflect.Value, tag string, baseoff uintptr)
this is the function to process a given field when walking the style
type WidgetBase ¶
type WidgetBase struct { Node2DBase CSS ki.Props `` /* 201-byte string literal not displayed */ CSSAgg ki.Props `json:"-" xml:"-" desc:"aggregated css properties from all higher nodes down to me"` Parts Layout `` /* 214-byte string literal not displayed */ }
Widget base type -- manages control elements and provides standard box model rendering
func (*WidgetBase) CSSProps ¶
func (g *WidgetBase) CSSProps() (css, agg *ki.Props)
func (*WidgetBase) ChildrenBBox2D ¶
func (g *WidgetBase) ChildrenBBox2D() image.Rectangle
func (*WidgetBase) ComputeBBox2D ¶
func (g *WidgetBase) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)
func (*WidgetBase) ComputeBBox2DWidget ¶
func (g *WidgetBase) ComputeBBox2DWidget(parBBox image.Rectangle, delta image.Point)
func (*WidgetBase) ConfigPartsIconLabel ¶
func (g *WidgetBase) ConfigPartsIconLabel(icn *Icon, txt string) (config kit.TypeAndNameList, icIdx, lbIdx int)
ConfigPartsIconLabel returns a standard config for creating parts, of icon and label left-to right in a row, based on whether items are nil or empty
func (*WidgetBase) ConfigPartsSetIconLabel ¶
func (g *WidgetBase) ConfigPartsSetIconLabel(icn *Icon, txt string, icIdx, lbIdx int)
set the icon and text values in parts, and get part style props, using given props if not set in object props
func (*WidgetBase) FocusChanged2D ¶
func (g *WidgetBase) FocusChanged2D(gotFocus bool)
func (*WidgetBase) Init2D ¶
func (g *WidgetBase) Init2D()
func (*WidgetBase) Init2DWidget ¶
func (g *WidgetBase) Init2DWidget()
func (*WidgetBase) Layout2D ¶
func (g *WidgetBase) Layout2D(parBBox image.Rectangle)
func (*WidgetBase) Layout2DParts ¶
func (g *WidgetBase) Layout2DParts(parBBox image.Rectangle)
func (*WidgetBase) Layout2DWidget ¶
func (g *WidgetBase) Layout2DWidget(parBBox image.Rectangle)
func (*WidgetBase) MeasureTextSize ¶
func (g *WidgetBase) MeasureTextSize(txt string) (w, h float32)
measure given text string using current style
func (*WidgetBase) Move2DWidget ¶
func (g *WidgetBase) Move2DWidget(delta image.Point, parBBox image.Rectangle)
func (*WidgetBase) New ¶
func (n *WidgetBase) New() ki.Ki
func (*WidgetBase) PartsNeedUpdateIconLabel ¶
func (g *WidgetBase) PartsNeedUpdateIconLabel(icn *Icon, txt string) bool
check if parts need to be updated -- for ConfigPartsIfNeeded
func (*WidgetBase) ReRender2D ¶
func (g *WidgetBase) ReRender2D() (node Node2D, layout bool)
func (*WidgetBase) Render2DParts ¶
func (g *WidgetBase) Render2DParts()
func (*WidgetBase) Render2DText ¶
func (g *WidgetBase) Render2DText(txt string)
render a text string in standard box model (e.g., label for a button, etc)
func (*WidgetBase) RenderBoxImpl ¶
func (g *WidgetBase) RenderBoxImpl(pos Vec2D, sz Vec2D, rad float32)
func (*WidgetBase) RenderStdBox ¶
func (g *WidgetBase) RenderStdBox(st *Style)
draw standard box using given style
func (*WidgetBase) Size2D ¶
func (g *WidgetBase) Size2D()
func (*WidgetBase) Size2DAddSpace ¶
func (g *WidgetBase) Size2DAddSpace()
add space to existing AllocSize
func (*WidgetBase) Size2DFromText ¶
func (g *WidgetBase) Size2DFromText(txt string)
set our LayData.AllocSize from measured text size
func (*WidgetBase) Size2DFromWH ¶
func (g *WidgetBase) Size2DFromWH(w, h float32)
set our LayData.AllocSize from constraints
func (*WidgetBase) Size2DWidget ¶
func (g *WidgetBase) Size2DWidget()
func (*WidgetBase) SizeFromParts ¶
func (g *WidgetBase) SizeFromParts()
type Window ¶
type Window struct { NodeBase Viewport *Viewport2D `json:"-" xml:"-" desc:"convenience pointer to our viewport child that handles all of our rendering"` OSWin oswin.Window `json:"-" xml:"-" desc:"OS-specific window interface"` WinTex oswin.Texture `` /* 127-byte string literal not displayed */ EventSigs [oswin.EventTypeN]ki.Signal `json:"-" xml:"-" desc:"signals for communicating each type of event"` Focus ki.Ki `json:"-" xml:"-" desc:"node receiving keyboard events"` Dragging ki.Ki `json:"-" xml:"-" desc:"node receiving mouse dragging events"` Popup ki.Ki `jsom:"-" xml:"-" desc:"Current popup viewport that gets all events"` PopupStack []ki.Ki `jsom:"-" xml:"-" desc:"stack of popups"` FocusStack []ki.Ki `jsom:"-" xml:"-" desc:"stack of focus"` NextPopup ki.Ki `json:"-" xml:"-" desc:"this popup will be pushed at the end of the current event cycle"` DoFullRender bool `json:"-" xml:"-" desc:"triggers a full re-render of the window within the event loop -- cleared once done"` // contains filtered or unexported fields }
Window provides an OS-specific window and all the associated event handling
func NewDialogWin ¶
NewDialogWin creates a new dialog window with given 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 NewWindow ¶
func NewWindow(name string, opts *oswin.NewWindowOptions) *Window
NewWindow creates a new window with given name and options
func NewWindow2D ¶
NewWindow2D creates a new standard 2D window with given name and sizing, with default positioning, and initializes a 2D viewport within it -- stdPixels means use standardized "pixel" units for the display size (96 per inch), not the actual underlying raw display dot pixels
func (*Window) BenchmarkFullRender ¶
func (w *Window) BenchmarkFullRender()
run benchmark of 50 full re-renders, report targeted profile results
func (*Window) BenchmarkReRender ¶
func (w *Window) BenchmarkReRender()
run benchmark of 50 just-re-renders, not full rebuilds
func (*Window) ClearNonFocus ¶
func (w *Window) ClearNonFocus()
ClearNonFocus clears the focus of any non-w.Focus item -- sometimes can get off
func (*Window) ClosePopup ¶
close given popup -- must be the current one -- returns false if not
func (*Window) DeletePopupMenu ¶
DeletePopupMenu returns true if the given popup item should be deleted
func (*Window) DisconnectNode ¶
disconnect node from all signals
func (*Window) DisconnectPopup ¶
disconnect given popup -- typically the current one
func (*Window) EndCPUMemProfile ¶
func (w *Window) EndCPUMemProfile()
func (*Window) EndTargProfile ¶
func (w *Window) EndTargProfile()
end targeted profiling and print report
func (*Window) EventLoop ¶
func (w *Window) EventLoop()
start the event loop running -- runs in a separate goroutine
func (*Window) FullReRender ¶
func (w *Window) FullReRender()
FullReRender can be called to trigger a full re-render of the window
func (*Window) FullUpdate ¶
func (w *Window) FullUpdate()
FullUpdate does a complete update of window pixels -- grab pixels from all the different active viewports
func (*Window) GenMouseFocusEvents ¶
process mouse.MoveEvent to generate mouse.FocusEvent events
func (*Window) IsInScope ¶
func (w *Window) IsInScope(gii Node2D, gi *Node2DBase) bool
IsInScope returns true if the given object is in scope for receiving events
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) PopFocus ¶
func (w *Window) PopFocus()
pop Mask off the focus stack and set to current focus
func (*Window) ReceiveEventType ¶
ReceiveEventType adds a Signal connection for given event type to given receiver
func (*Window) SendEventSignal ¶
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)
func (*Window) SetFocusItem ¶
set focus to given item -- returns true if focus changed
func (*Window) SetNextFocusItem ¶
set the focus on the next item that can accept focus -- returns true if a focus item found
func (*Window) SetPrevFocusItem ¶
set the focus on the previous item
func (*Window) StartCPUMemProfile ¶
func (w *Window) StartCPUMemProfile()
func (*Window) StartEventLoop ¶
func (w *Window) StartEventLoop()
func (*Window) StartEventLoopNoWait ¶
func (w *Window) StartEventLoopNoWait()
func (*Window) StartTargProfile ¶
func (w *Window) StartTargProfile()
start targeted profiling using prof package
func (*Window) UpdateFullVpRegion ¶
func (w *Window) UpdateFullVpRegion(vp *Viewport2D, vpBBox, winBBox image.Rectangle)
UpdateVpPixels updates pixels for one viewport region on the screen, in its entirety
func (*Window) UpdateVpRegion ¶
func (w *Window) UpdateVpRegion(vp *Viewport2D, vpBBox, winBBox image.Rectangle)
UpdateVpRegion updates pixels for one viewport region on the screen, using vpBBox bounding box for the viewport, and winBBox bounding box for the window (which should not be empty given the overall logic driving updates) -- the Window has a its OnlySelfUpdate logic for determining when to flush changes to the underlying OSWindow -- wrap updates in win.UpdateStart / win.UpdateEnd to actually flush the updates to be visible
func (*Window) UpdateVpRegionFromMain ¶
UpdateVpRegionFromMain basically clears the region where the vp would show up, from the main
func (*Window) WinViewport2D ¶
func (w *Window) WinViewport2D() *Viewport2D
type XFormMatrix2D ¶
type XFormMatrix2D struct {
XX, YX, XY, YY, X0, Y0 float32
}
func Identity2D ¶
func Identity2D() XFormMatrix2D
func Rotate2D ¶
func Rotate2D(angle float32) XFormMatrix2D
func Scale2D ¶
func Scale2D(x, y float32) XFormMatrix2D
func Shear2D ¶
func Shear2D(x, y float32) XFormMatrix2D
func Translate2D ¶
func Translate2D(x, y float32) XFormMatrix2D
func (XFormMatrix2D) Multiply ¶
func (a XFormMatrix2D) Multiply(b XFormMatrix2D) XFormMatrix2D
func (XFormMatrix2D) Rotate ¶
func (a XFormMatrix2D) Rotate(angle float32) XFormMatrix2D
func (XFormMatrix2D) Scale ¶
func (a XFormMatrix2D) Scale(x, y float32) XFormMatrix2D
func (XFormMatrix2D) Shear ¶
func (a XFormMatrix2D) Shear(x, y float32) XFormMatrix2D
func (XFormMatrix2D) TransformPoint ¶
func (a XFormMatrix2D) TransformPoint(x, y float32) (tx, ty float32)
func (XFormMatrix2D) TransformPointToInt ¶
func (a XFormMatrix2D) TransformPointToInt(x, y float32) (tx, ty int)
func (XFormMatrix2D) TransformVector ¶
func (a XFormMatrix2D) TransformVector(x, y float32) (tx, ty float32)
func (XFormMatrix2D) Translate ¶
func (a XFormMatrix2D) Translate(x, y float32) XFormMatrix2D
Source Files
¶
- actions.go
- align_string.go
- bezier.go
- borderdrawstyle_string.go
- boxsides_string.go
- buttons.go
- buttonsignals_string.go
- buttonstates_string.go
- color.go
- dialogs.go
- dialogstate_string.go
- dims2d_string.go
- doc.go
- fill.go
- fillrule_string.go
- font.go
- fontstyles_string.go
- fontweights_string.go
- geom2d.go
- geom3d.go
- gieditor.go
- iconcontexts_string.go
- icons.go
- keyfun.go
- keyfunctions_string.go
- layout.go
- layouts_string.go
- linecap_string.go
- linejoin_string.go
- mapview.go
- menus.go
- node.go
- node2d.go
- nodeflags_string.go
- overflow_string.go
- paint.go
- paintserver.go
- paintservers_string.go
- prefs.go
- rowcol_string.go
- shapes2d.go
- sliceview.go
- sliders.go
- slidersignals_string.go
- sliderstates_string.go
- splitview.go
- stroke.go
- structview.go
- style.go
- svg.go
- tabview.go
- tabviewsignals_string.go
- text.go
- textfieldsignals_string.go
- textfieldstates_string.go
- textwidgets.go
- treeview.go
- treeviewsignals_string.go
- treeviewstates_string.go
- valueview.go
- viewboxmeetorslice_string.go
- viewport2d.go
- widget.go
- window.go
Directories
¶
Path | Synopsis |
---|---|
examples
|
|
Package oswin provides interfaces for OS-specific GUI hardware for portable two-dimensional graphics and input events.
|
Package oswin provides interfaces for OS-specific GUI hardware for portable two-dimensional graphics and input events. |
driver
Package driver provides the default driver for accessing a screen.
|
Package driver provides the default driver for accessing a screen. |
driver/gldriver
Package gldriver provides an OpenGL driver for accessing a screen.
|
Package gldriver provides an OpenGL driver for accessing a screen. |
driver/internal/drawer
Package drawer provides functions that help implement screen.Drawer methods.
|
Package drawer provides functions that help implement screen.Drawer methods. |
driver/internal/errapp
Package errapp provides a stub App implementation.
|
Package errapp provides a stub App implementation. |
driver/internal/event
Package event provides an infinitely buffered double-ended queue of events.
|
Package event provides an infinitely buffered double-ended queue of events. |
driver/internal/lifecycler
Package lifecycler tracks a window's lifecycle state.
|
Package lifecycler tracks a window's lifecycle state. |
driver/internal/swizzle
Package swizzle provides functions for converting between RGBA pixel formats.
|
Package swizzle provides functions for converting between RGBA pixel formats. |
driver/internal/x11key
x11key contains X11 numeric codes for the keyboard and mouse.
|
x11key contains X11 numeric codes for the keyboard and mouse. |
driver/windriver
Package windriver provides the Windows driver for accessing a screen.
|
Package windriver provides the Windows driver for accessing a screen. |
driver/x11driver
Package x11driver provides the X11 driver for accessing a screen.
|
Package x11driver provides the X11 driver for accessing a screen. |
key
Package key defines an event for physical keyboard keys, for the GoGi GUI system.
|
Package key defines an event for physical keyboard keys, for the GoGi GUI system. |
lifecycle
Package lifecycle defines an event for an app's lifecycle, for the GoGI GUI system.
|
Package lifecycle defines an event for an app's lifecycle, for the GoGI GUI system. |
mouse
Package mouse defines mouse events, for the GoGi GUI system.
|
Package mouse defines mouse events, for the GoGi GUI system. |
paint
Package paint defines an event for the app being ready to paint.
|
Package paint defines an event for the app being ready to paint. |
touch
Package touch defines an event for touch input, for the GoGi GUI system.
|
Package touch defines an event for touch input, for the GoGi GUI system. |
window
Package window defines an event associated with windows -- including changes in the dimensions, physical resolution and orientation of the app's window, and iconify, open and close events (see also lifecycle events, which pertain to the main app window -- these window events are for all windows including dialogs and popups)
|
Package window defines an event associated with windows -- including changes in the dimensions, physical resolution and orientation of the app's window, and iconify, open and close events (see also lifecycle events, which pertain to the main app window -- these window events are for all windows including dialogs and popups) |
package oswin provides OS-specific windows and events.
|
package oswin provides OS-specific windows and events. |
Package Units supports full range of CSS-style length units (em, px, dp, etc) The unit is stored along with a value, and can be converted at a later point into a raw display pixel value using the Context which contains all the necessary reference values to perform the conversion.
|
Package Units supports full range of CSS-style length units (em, px, dp, etc) The unit is stored along with a value, and can be converted at a later point into a raw display pixel value using the Context which contains all the necessary reference values to perform the conversion. |