gi: github.com/goki/gi Index | Files | Directories

package gi

import "github.com/goki/gi"

Package Gi (GoGi) provides a Graphical Interface based on GoKi Tree Node structs

2D and 3D (TBD) scenegraphs supported, each rendering to respective Viewport which in turn can be integrated within the other type of scenegraph.

The 2D scenegraph supports:

* Widget nodes for GUI actions (Buttons, Menus etc) -- render directly via Paint
* Layouts for placing widgets, which are also container nodes
* CSS-based styling, directly on Node Props (properties), and CSS StyleSheet
* svg sub-package with SVG Viewport and shapes, paths, etc -- full SVG suport
* Icon is a wrapper around an SVG -- any SVG icon can be used

Layout Logic

All 2D scenegraphs are controlled by the Layout, which provides the logic for organizing widgets / elements within the constraints of the display. Typically start with a vertical LayoutVert in the viewport, with LayoutHoriz's within that, or a LayoutGrid for more complex layouts:

	win := gi.NewWindow2D("test window", width, height)
	vp := win.WinViewport2D()
	updt := vp.UpdateStart()

	vlay := win.SetMainVLay() // or SetMainFrame

	row1 := vlay.AddNewChild(gi.KiT_Layout, "row1").(*gi.Layout)
	row1.Lay = gi.LayoutHoriz

	...

    vp.UpdateEnd(updt)

Controlling the layout involves the following style properties:

	* width / height: sets the preferred size of item -- layout tries to give
      this amount of space unless it can't in which case it falls back on:

	* min-width / min-height: minimum size -- will not scale below this size.
      if not specified, it defaults to 1 em (the size of 1 character)

	* max-width / max-height: maximum size -- will not exceed this size if
      specified, otherwise if 0 it is ignored and preferred size is used.  If
      a negative number is specified, then the item stretches to take up
      available room.  The Stretch node is a builtin type that has this
      property set automatically, and can be added to any layout to fill up
      any available space.  The preferred size of the item is used to
      determine how much of the space is used by each stretchable element, so
      you can set that to achieve different proportional spacing.  By default
      the Stretch is just the minumum 1em in preferred size.

	* align-horiz / align-vert: for the other dimension in a Layout (e.g., for
      LayoutHoriz, the vertical dimension) this specifies how the items are
      aligned within the available space (e.g., tops, bottoms, centers).  In
      the dimension of the Layout (horiz for LayoutHoriz) it determines how
      extra space is allocated (only if there aren't any infinitely stretchy
      elements), e.g., right / left / center or justified.

	* SetFixedWidth / Height method can be used to set all size params to the
      same value, causing that item to be definitively sized.  This is
      convenient for sizing the Space node which adds a fixed amount of space
      (1em by default).

    * See the wiki for more detailed documentation.

Signals

All widgets send appropriate signals about user actions -- Connect to those and check the signal type to determine the type of event.

Views

Views are Widgets that automatically display and interact with standard Go data, including structs, maps, slices, and the primitive data elements (string, int, etc). This implements a form of model / view separation between data and GUI representation thereof, where the models are the Go data elements themselves.

This provides automatic, powerful GUI access to essentially any data in any other Go package. Furthermore, the ValueView framework allows for easy customization and extension of the GUI representation, based on the classic Go "Stringer"-like interface paradigm -- simply define a ValueView() method on any type, returning giv.ValueView that manages the interface between data structures and GUI represnetations.

See giv sub-package for all the View elements

SVG for Icons, Displays, etc

SVG (Structured Vector Graphics) is used icons, and for rendering any kind of graphical output (drawing a graph, dial, etc). See svg sub-package.

Overlay

The gi.Window contains an OverlayVp viewport with nodes that are rendered on top of the regular scenegraph -- this is used for drag-n-drop and other kinds of transient control / manipulation functionality. Overlay elements are not subject to the standard layout constraints (via having the Overlay NodeFlag set)

Index

Package Files

action.go align_string.go bars.go baselineshifts_string.go bitmap.go borderdrawstyle_string.go boxsides_string.go buttons.go buttonsignals_string.go buttonstates_string.go color.go colorparse.go colorsources_string.go combobox.go complete.go completesignals_string.go css.go dialogs.go dialogstate_string.go dims2d_string.go doc.go eventpris_string.go fill.go fillrule_string.go focuschanges_string.go font.go fontstretch_string.go fontstyles_string.go fontvariants_string.go fontweights_string.go frame.go geom2d.go geom3d.go icon.go keyfun.go keyfuns_string.go label.go labelstates_string.go layout.go layouts_string.go linecap_string.go linejoin_string.go menus.go node.go node2d.go nodeflags_string.go overflow_string.go paint.go prefs.go rowcol_string.go sliders.go slidersignals_string.go sliderstates_string.go spinbox.go splitview.go stripes_string.go stroke.go style.go text.go textanchors_string.go textdecorations_string.go textdirections_string.go textfield.go textfieldsignals_string.go textfieldstates_string.go unicodebidi_string.go vectoreffect_string.go viewport2d.go views.go whitespaces_string.go widget.go widgetsignals_string.go window.go

Constants

const MaxDx float32 = math.Pi / 8

MaxDx is the Maximum radians a cubic splice is allowed to span in ellipse parametric when approximating an off-axis ellipse.

Variables

var (
    ColorModel    color.Model = color.ModelFunc(colorModel)
    RGBAf32Model  color.Model = color.ModelFunc(rgbaf32Model)
    NRGBAf32Model color.Model = color.ModelFunc(nrgbaf32Model)
    HSLAModel     color.Model = color.ModelFunc(hslaf32Model)
)
var ActionProps = ki.Props{
    "border-width":     units.NewValue(0, units.Px),
    "border-radius":    units.NewValue(0, units.Px),
    "border-color":     &Prefs.Colors.Border,
    "border-style":     BorderSolid,
    "box-shadow.color": &Prefs.Colors.Shadow,
    "text-align":       AlignCenter,
    "background-color": &Prefs.Colors.Control,
    "color":            &Prefs.Colors.Font,
    "padding":          units.NewValue(2, units.Px),
    "margin":           units.NewValue(2, units.Px),
    "min-width":        units.NewValue(1, units.Em),
    "min-height":       units.NewValue(1, units.Em),
    "#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.Colors.Icon,
        "stroke":  &Prefs.Colors.Font,
    },
    "#space": ki.Props{
        "width":     units.NewValue(1, units.Ch),
        "min-width": units.NewValue(1, units.Ch),
    },
    "#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.Colors.Icon,
        "stroke":         &Prefs.Colors.Font,
    },
    "#ind-stretch": ki.Props{
        "width": units.NewValue(1, units.Em),
    },
    "#shortcut": ki.Props{
        "margin":  units.NewValue(0, units.Px),
        "padding": units.NewValue(0, units.Px),
    },
    "#sc-stretch": ki.Props{
        "min-width": units.NewValue(2, units.Em),
    },
    ".menu-action": ki.Props{
        "padding":   units.NewValue(2, units.Px),
        "margin":    units.NewValue(0, units.Px),
        "max-width": -1,
        "indicator": "widget-wedge-right",
        ButtonSelectors[ButtonActive]: ki.Props{
            "background-color": "lighter-0",
        },
        ButtonSelectors[ButtonInactive]: ki.Props{
            "border-color": "highlight-50",
            "color":        "highlight-50",
        },
        ButtonSelectors[ButtonHover]: ki.Props{
            "background-color": "highlight-10",
        },
        ButtonSelectors[ButtonFocus]: ki.Props{
            "border-width":     units.NewValue(2, units.Px),
            "background-color": "samelight-50",
        },
        ButtonSelectors[ButtonDown]: ki.Props{
            "color":            "highlight-90",
            "background-color": "highlight-30",
        },
        ButtonSelectors[ButtonSelected]: ki.Props{
            "background-color": &Prefs.Colors.Select,
        },
    },
    ".bar-action": ki.Props{
        "padding":   units.NewValue(4, units.Px),
        "margin":    units.NewValue(0, units.Px),
        "indicator": "none",
        ButtonSelectors[ButtonActive]: ki.Props{
            "background-color": "linear-gradient(lighter-0, highlight-10)",
        },
        ButtonSelectors[ButtonInactive]: ki.Props{
            "border-color": "lighter-50",
            "color":        "lighter-50",
        },
        ButtonSelectors[ButtonHover]: ki.Props{
            "background-color": "linear-gradient(highlight-10, highlight-10)",
        },
        ButtonSelectors[ButtonFocus]: ki.Props{
            "border-width":     units.NewValue(2, units.Px),
            "background-color": "linear-gradient(samelight-50, highlight-10)",
        },
        ButtonSelectors[ButtonDown]: ki.Props{
            "color":            "lighter-90",
            "background-color": "linear-gradient(highlight-30, highlight-10)",
        },
        ButtonSelectors[ButtonSelected]: ki.Props{
            "background-color": "linear-gradient(pref(Select), highlight-10)",
        },
    },
    ".": ki.Props{
        ButtonSelectors[ButtonActive]: ki.Props{
            "background-color": "linear-gradient(lighter-0, highlight-10)",
        },
        ButtonSelectors[ButtonInactive]: ki.Props{
            "border-color": "lighter-50",
            "color":        "lighter-50",
        },
        ButtonSelectors[ButtonHover]: ki.Props{
            "background-color": "linear-gradient(highlight-10, highlight-10)",
        },
        ButtonSelectors[ButtonFocus]: ki.Props{
            "border-width":     units.NewValue(2, units.Px),
            "background-color": "linear-gradient(samelight-50, highlight-10)",
        },
        ButtonSelectors[ButtonDown]: ki.Props{
            "color":            "lighter-90",
            "background-color": "linear-gradient(highlight-30, highlight-10)",
        },
        ButtonSelectors[ButtonSelected]: ki.Props{
            "background-color": "linear-gradient(pref(Select), highlight-10)",
        },
    },
}
var AutoScrollRate = float32(1.0)

AutoScrollRate determines the rate of auto-scrolling of layouts

var AvailKeyMapsChanged = false

AvailKeyMapsChanged is used to update giv.KeyMapsView toolbars via following menu, toolbar props update methods -- not accurate if editing any other map but works for now..

var BitmapProps = ki.Props{
    "background-color": &Prefs.Colors.Background,
}
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.Colors.Border,
    "border-style":  BorderSolid,
    "padding":       units.NewValue(4, units.Px),
    "margin":        units.NewValue(2, units.Px),
    "min-width":     units.NewValue(1, units.Em),
    "min-height":    units.NewValue(1, units.Em),

    "box-shadow.color": &Prefs.Colors.Shadow,
    "text-align":       AlignCenter,
    "background-color": &Prefs.Colors.Control,
    "color":            &Prefs.Colors.Font,
    "#space": ki.Props{
        "width":     units.NewValue(1, units.Ch),
        "min-width": units.NewValue(1, units.Ch),
    },
    "#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.Colors.Icon,
        "stroke":  &Prefs.Colors.Font,
    },
    "#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.Colors.Icon,
        "stroke":         &Prefs.Colors.Font,
    },
    "#ind-stretch": ki.Props{
        "width": units.NewValue(1, units.Em),
    },
    ButtonSelectors[ButtonActive]: ki.Props{
        "background-color": "linear-gradient(lighter-0, highlight-10)",
    },
    ButtonSelectors[ButtonInactive]: ki.Props{
        "border-color": "lighter-50",
        "color":        "lighter-50",
    },
    ButtonSelectors[ButtonHover]: ki.Props{
        "background-color": "linear-gradient(highlight-10, highlight-10)",
    },
    ButtonSelectors[ButtonFocus]: ki.Props{
        "border-width":     units.NewValue(2, units.Px),
        "background-color": "linear-gradient(samelight-50, highlight-10)",
    },
    ButtonSelectors[ButtonDown]: ki.Props{
        "color":            "lighter-90",
        "background-color": "linear-gradient(highlight-30, highlight-10)",
    },
    ButtonSelectors[ButtonSelected]: ki.Props{
        "background-color": "linear-gradient(pref(Select), highlight-10)",
    },
}
var ButtonSelectors = []string{":active", ":inactive", ":hover", ":focus", ":down", ":selected"}

Style selector names for the different states: https://www.w3schools.com/cssref/css_selectors.asp

var CheckBoxProps = ki.Props{
    "icon":             "widget-checked-box",
    "icon-off":         "widget-unchecked-box",
    "text-align":       AlignLeft,
    "color":            &Prefs.Colors.Font,
    "background-color": &Prefs.Colors.Control,
    "margin":           units.NewValue(1, units.Px),
    "padding":          units.NewValue(1, units.Px),
    "border-width":     units.NewValue(0, units.Px),
    "#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.Colors.Control,
        "stroke":           &Prefs.Colors.Font,
    },
    "#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.Colors.Control,
        "stroke":           &Prefs.Colors.Font,
    },
    "#space": ki.Props{
        "width": units.NewValue(.1, units.Ch),
    },
    "#label": ki.Props{
        "margin":  units.NewValue(0, units.Px),
        "padding": units.NewValue(0, units.Px),
    },
    ButtonSelectors[ButtonActive]: ki.Props{
        "background-color": "lighter-0",
    },
    ButtonSelectors[ButtonInactive]: ki.Props{
        "border-color": "highlight-50",
        "color":        "highlight-50",
    },
    ButtonSelectors[ButtonHover]: ki.Props{
        "background-color": "highlight-10",
    },
    ButtonSelectors[ButtonFocus]: ki.Props{
        "border-width":     units.NewValue(2, units.Px),
        "background-color": "samelight-50",
    },
    ButtonSelectors[ButtonDown]: ki.Props{
        "color":            "highlight-90",
        "background-color": "highlight-30",
    },
    ButtonSelectors[ButtonSelected]: ki.Props{
        "background-color": &Prefs.Colors.Select,
    },
}
var ColorProps = ki.Props{
    "style-prop": true,
}
var ComboBoxProps = ki.Props{
    "border-width":     units.NewValue(1, units.Px),
    "border-radius":    units.NewValue(4, units.Px),
    "border-color":     &Prefs.Colors.Border,
    "border-style":     BorderSolid,
    "padding":          units.NewValue(4, units.Px),
    "margin":           units.NewValue(4, units.Px),
    "text-align":       AlignCenter,
    "background-color": &Prefs.Colors.Control,
    "color":            &Prefs.Colors.Font,
    "#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.Colors.Icon,
        "stroke":  &Prefs.Colors.Font,
    },
    "#label": ki.Props{
        "margin":  units.NewValue(0, units.Px),
        "padding": units.NewValue(0, units.Px),
    },
    "#text": ki.Props{
        "margin":    units.NewValue(0, units.Px),
        "padding":   units.NewValue(0, units.Px),
        "max-width": -1,
    },
    "#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.Colors.Icon,
        "stroke":         &Prefs.Colors.Font,
    },
    "#ind-stretch": ki.Props{
        "width": units.NewValue(1, units.Em),
    },
    ButtonSelectors[ButtonActive]: ki.Props{
        "background-color": "linear-gradient(lighter-0, highlight-10)",
    },
    ButtonSelectors[ButtonInactive]: ki.Props{
        "border-color": "highlight-50",
        "color":        "highlight-50",
    },
    ButtonSelectors[ButtonHover]: ki.Props{
        "background-color": "linear-gradient(highlight-10, highlight-10)",
    },
    ButtonSelectors[ButtonFocus]: ki.Props{
        "border-width":     units.NewValue(2, units.Px),
        "background-color": "linear-gradient(samelight-50, highlight-10)",
    },
    ButtonSelectors[ButtonDown]: ki.Props{
        "color":            "highlight-90",
        "background-color": "linear-gradient(highlight-30, highlight-10)",
    },
    ButtonSelectors[ButtonSelected]: ki.Props{
        "background-color": "linear-gradient(pref(Select), highlight-10)",
        "color":            "highlight-90",
    },
}
var CurIconList []IconName

CurIconList holds the current icon list, alpha sorted -- set at startup

var CursorBlinkMSec = 500

CursorBlinkMSec is number of milliseconds that cursor blinks on and off -- set to 0 to disable blinking

var CustomAppMenuFunc = (func(m *Menu, win *Window))(nil)

CustomAppMenuFunc is a function called by AddAppMenu after the AddStdAppMenu is called -- apps can set this function to add / modify / etc the menu

var DNDStartMSec = 200

DNDStartMSec is the number of milliseconds to wait before initiating a drag-n-drop event -- gotta drag it like you mean it

var DNDStartPix = 20

DNDStartPix is the number of pixels that must be moved before initiating a drag-n-drop event -- gotta drag it like you mean it

var DefaultKeyMap = KeyMapName("MacEmacs")

DefaultKeyMap is the overall default keymap -- reinitialized in gimain init() depending on platform

var DefaultPaths = FavPaths{
    {"home", "home", "~"},
    {"desktop", "Desktop", "~/Desktop"},
    {"documents", "Documents", "~/Documents"},
    {"folder-download", "Downloads", "~/Downloads"},
    {"computer", "root", "/"},
}

DefaultPaths are default favorite paths

var DialogProps = ki.Props{
    "color": &Prefs.Colors.Font,
    "#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":    &Prefs.Colors.Shadow,
    },
    "#title": ki.Props{

        "max-width":        units.NewValue(-1, units.Px),
        "text-align":       AlignCenter,
        "vertical-align":   AlignTop,
        "background-color": "none",
    },
    "#prompt": ki.Props{
        "white-space":      WhiteSpaceNormal,
        "max-width":        -1,
        "width":            units.NewValue(30, units.Ch),
        "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 DragStartMSec = 50

DragStartMSec is the number of milliseconds to wait before initiating a regular mouse drag event (as opposed to a basic mouse.Press)

var DragStartPix = 4

DragStartPix is the number of pixels that must be moved before initiating a regular mouse drag event (as opposed to a basic mouse.Press)

var EventSkipLagMSec = 50

EventSkipLagMSec is the number of milliseconds of lag between the time the event was sent to the time it is being processed, above which a repeated event type (scroll, drag, resize) is skipped

var FontExts = map[string]struct{}{
    ".ttf": struct{}{},
    ".ttc": struct{}{},
}
var FontFallbacks = map[string]string{
    "serif":            "Times New Roman",
    "times":            "Times New Roman",
    "Times New Roman":  "Liberation Serif",
    "Liberation Serif": "NotoSerif",
    "sans-serif":       "NotoSans",
    "NotoSans":         "Go",
    "courier":          "Courier",
    "Courier":          "Courier New",
    "Courier New":      "NotoSansMono",
    "NotoSansMono":     "Go Mono",
    "monospace":        "NotoSansMono",
    "cursive":          "Comic Sans",
    "Comic Sans":       "Comic Sans MS",
    "fantasy":          "Impact",
    "Impact":           "Impac",
}

FontFallbacks are a list of fallback fonts to try, at the basename level. Make sure there are no loops! Include Noto versions of everything in this because they have the most stretch options, so they should be in the mix if they have been installed, and include "Go" options last.

var FontInfoExample = "AaBbCcIiPpQq12369$€¢?.:/()àáâãäåæç日本中国⇧⌘"

FontInfoExample is example text to demonstrate fonts -- from Inkscape plus extra

var FontSizePoints = map[string]float32{
    "xx-small": 7,
    "x-small":  7.5,
    "small":    10,
    "smallf":   10,
    "medium":   12,
    "large":    14,
    "x-large":  18,
    "xx-large": 24,
}

FontSizePoints maps standard font names to standard point sizes -- we use dpi zoom scaling instead of rescaling "medium" font size, so generally use these values as-is. smaller and larger relative scaling can move in 2pt increments

var FontStretchNames = []string{"Normal", "UltraCondensed", "ExtraCondensed", "SemiCondensed", "SemiExpanded", "ExtraExpanded", "UltraExpanded", "Condensed", "Expanded", "Condensed", "Expanded"}

FontStretchNames contains the uppercase names of all the valid font stretches used in the regularized font names. The first name is the baseline default and will be omitted from font names. Order must have names that are subsets of other names at the end so they only match if the more specific one hasn't! And also match the FontStretch enum.

var FontStyleFields = initFontStyle()

FontStyleFields contain the StyledFields for FontStyle type

var FontStyleNames = []string{"Normal", "Italic", "Oblique"}

FontStyleNames contains the uppercase names of all the valid font styles used in the regularized font names. The first name is the baseline default and will be omitted from font names.

var FontWeightNameVals = []FontWeights{WeightNormal, WeightThin, WeightExtraLight, WeightLight, WeightMedium, WeightSemiBold, WeightExtraBold, WeightBold, WeightBlack}

FontWeightNameVals is 1-to-1 index map from FontWeightNames to corresponding weight value (using more semantic term instead of numerical one)

var FontWeightNames = []string{"Normal", "Thin", "ExtraLight", "Light", "Medium", "SemiBold", "ExtraBold", "Bold", "Black"}

FontWeightNames contains the uppercase names of all the valid font weights used in the regularized font names. The first name is the baseline default and will be omitted from font names. Order must have names that are subsets of other names at the end so they only match if the more specific one hasn't!

var FontWeightToNameMap = map[FontWeights]string{
    Weight100:        "Thin",
    WeightThin:       "Thin",
    Weight200:        "ExtraLight",
    WeightExtraLight: "ExtraLight",
    Weight300:        "Light",
    WeightLight:      "Light",
    Weight400:        "",
    WeightNormal:     "",
    Weight500:        "Medium",
    WeightMedium:     "Medium",
    Weight600:        "SemiBold",
    WeightSemiBold:   "SemiBold",
    Weight700:        "Bold",
    WeightBold:       "Bold",
    Weight800:        "ExtraBold",
    WeightExtraBold:  "ExtraBold",
    Weight900:        "Black",
    WeightBlack:      "Black",
    WeightBolder:     "Medium",
    WeightLighter:    "Light",
}

FontWeightToNameMap maps all the style enums to canonical regularized font names

var FrameProps = ki.Props{
    "border-width":     units.NewValue(2, units.Px),
    "border-radius":    units.NewValue(0, units.Px),
    "border-color":     &Prefs.Colors.Border,
    "border-style":     BorderSolid,
    "padding":          units.NewValue(2, units.Px),
    "margin":           units.NewValue(2, units.Px),
    "color":            &Prefs.Colors.Font,
    "background-color": &Prefs.Colors.Background,
}
var GoFonts = map[string]goFontInfo{
    "gofont/goregular":         {"Go", goregular.TTF},
    "gofont/gobold":            {"Go Bold", gobold.TTF},
    "gofont/gobolditalic":      {"Go Bold Italic", gobolditalic.TTF},
    "gofont/goitalic":          {"Go Italic", goitalic.TTF},
    "gofont/gomedium":          {"Go Medium", gomedium.TTF},
    "gofont/gomediumitalic":    {"Go Medium Italic", gomediumitalic.TTF},
    "gofont/gomono":            {"Go Mono", gomono.TTF},
    "gofont/gomonobold":        {"Go Mono Bold", gomonobold.TTF},
    "gofont/gomonobolditalic":  {"Go Mono Bold Italic", gomonobolditalic.TTF},
    "gofont/gomonoitalic":      {"Go Mono Italic", gomonoitalic.TTF},
    "gofont/gosmallcaps":       {"Go Small Caps", gosmallcaps.TTF},
    "gofont/gosmallcapsitalic": {"Go Small Caps Italic", gosmallcapsitalic.TTF},
}
var GradientDegToSides = map[string]string{
    "0deg":    "top",
    "360deg":  "top",
    "45deg":   "top right",
    "-315deg": "top right",
    "90deg":   "right",
    "-270deg": "right",
    "135deg":  "bottom right",
    "-225deg": "bottom right",
    "180deg":  "bottom",
    "-180deg": "bottom",
    "225deg":  "bottom left",
    "-135deg": "bottom left",
    "270deg":  "left",
    "-90deg":  "left",
    "315deg":  "top left",
    "-45deg":  "top left",
}

GradientDegToSides maps gradient degree notation to side notation

var HoverMaxPix = 5

HoverMaxPix is the maximum number of pixels that mouse can move and still register a Hover event

var HoverStartMSec = 1500

HoverStartMSec is the number of milliseconds to wait before initiating a hover event

var IconProps = ki.Props{
    "background-color": color.Transparent,
}
var KeyMapsProps = ki.Props{
    "MainMenu": ki.PropSlice{
        {"AppMenu", ki.BlankProp{}},
        {"File", ki.PropSlice{
            {"OpenPrefs", ki.Props{}},
            {"SavePrefs", ki.Props{
                "shortcut": "Command+S",
                "updtfunc": func(kmi interface{}, act *Action) {
                    act.SetActiveState(AvailKeyMapsChanged)
                },
            }},
            {"sep-file", ki.BlankProp{}},
            {"OpenJSON", ki.Props{
                "label":    "Open from file",
                "desc":     "You can save and open key maps to / from files to share, experiment, transfer, etc",
                "shortcut": "Command+O",
                "Args": ki.PropSlice{
                    {"File Name", ki.Props{
                        "ext": ".json",
                    }},
                },
            }},
            {"SaveJSON", ki.Props{
                "label": "Save to file",
                "desc":  "You can save and open key maps to / from files to share, experiment, transfer, etc",
                "Args": ki.PropSlice{
                    {"File Name", ki.Props{
                        "ext": ".json",
                    }},
                },
            }},
            {"RevertToStd", ki.Props{
                "desc":    "" /* 386 byte string literal not displayed */,
                "confirm": true,
            }},
        }},
        {"Edit", "Copy Cut Paste Dupe"},
        {"Window", "Windows"},
    },
    "ToolBar": ki.PropSlice{
        {"SavePrefs", ki.Props{
            "desc": "" /* 199 byte string literal not displayed */,
            "icon": "file-save",
            "updtfunc": func(kmi interface{}, act *Action) {
                act.SetActiveStateUpdt(AvailKeyMapsChanged)
            },
        }},
        {"sep-file", ki.BlankProp{}},
        {"OpenJSON", ki.Props{
            "label": "Open from file",
            "icon":  "file-open",
            "desc":  "You can save and open key maps to / from files to share, experiment, transfer, etc",
            "Args": ki.PropSlice{
                {"File Name", ki.Props{
                    "ext": ".json",
                }},
            },
        }},
        {"SaveJSON", ki.Props{
            "label": "Save to file",
            "icon":  "file-save",
            "desc":  "You can save and open key maps to / from files to share, experiment, transfer, etc",
            "Args": ki.PropSlice{
                {"File Name", ki.Props{
                    "ext": ".json",
                }},
            },
        }},
        {"sep-std", ki.BlankProp{}},
        {"ViewStd", ki.Props{
            "desc":    "" /* 172 byte string literal not displayed */,
            "confirm": true,
        }},
        {"RevertToStd", ki.Props{
            "icon":    "update",
            "desc":    "" /* 407 byte string literal not displayed */,
            "confirm": true,
        }},
    },
}

KeyMapsProps define the ToolBar and MenuBar for TableView of KeyMaps, e.g., giv.KeyMapsView

var KiT_Action = kit.Types.AddType(&Action{}, ActionProps)
var KiT_Align = kit.Enums.AddEnumAltLower(AlignN, false, StylePropProps, "Align")
var KiT_BaselineShifts = kit.Enums.AddEnumAltLower(BaselineShiftsN, false, StylePropProps, "Shift")
var KiT_Bitmap = kit.Types.AddType(&Bitmap{}, BitmapProps)
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_Color = kit.Types.AddType(&Color{}, ColorProps)
var KiT_ColorSources = kit.Enums.AddEnumAltLower(ColorSourcesN, false, StylePropProps, "")
var KiT_ColorSpec = kit.Types.AddType(&ColorSpec{}, nil)
var KiT_ComboBox = kit.Types.AddType(&ComboBox{}, ComboBoxProps)
var KiT_Complete = kit.Types.AddType(&Complete{}, nil)
var KiT_Dialog = kit.Types.AddType(&Dialog{}, DialogProps)
var KiT_Dims2D = kit.Enums.AddEnumAltLower(Dims2DN, false, nil, "")
var KiT_FillRule = kit.Enums.AddEnumAltLower(FillRuleN, false, StylePropProps, "FillRule")
var KiT_FontStretch = kit.Enums.AddEnumAltLower(FontStretchN, false, StylePropProps, "FontStr")
var KiT_FontStyles = kit.Enums.AddEnumAltLower(FontStylesN, false, StylePropProps, "Font")
var KiT_FontVariants = kit.Enums.AddEnumAltLower(FontVariantsN, false, StylePropProps, "FontVar")
var KiT_FontWeights = kit.Enums.AddEnumAltLower(FontWeightsN, false, StylePropProps, "Weight")
var KiT_Frame = kit.Types.AddType(&Frame{}, FrameProps)
var KiT_Gradient = kit.Types.AddType(&Gradient{}, nil)
var KiT_Icon = kit.Types.AddType(&Icon{}, IconProps)
var KiT_KeyFuns = kit.Enums.AddEnumAltLower(KeyFunsN, false, StylePropProps, "KeyFun")
var KiT_KeyMaps = kit.Types.AddType(&KeyMaps{}, KeyMapsProps)
var KiT_Label = kit.Types.AddType(&Label{}, LabelProps)
var KiT_LabelStates = kit.Enums.AddEnumAltLower(LabelStatesN, false, StylePropProps, "Label")
var KiT_Layout = kit.Types.AddType(&Layout{}, nil)
var KiT_Layouts = kit.Enums.AddEnumAltLower(LayoutsN, false, StylePropProps, "Layout")
var KiT_LineCap = kit.Enums.AddEnumAltLower(LineCapN, false, StylePropProps, "LineCap")
var KiT_LineJoin = kit.Enums.AddEnumAltLower(LineJoinN, false, StylePropProps, "LineJoin")
var KiT_Matrix2D = kit.Types.AddType(&Matrix2D{}, Matrix2DProps)
var KiT_MenuBar = kit.Types.AddType(&MenuBar{}, MenuBarProps)
var KiT_MenuButton = kit.Types.AddType(&MenuButton{}, MenuButtonProps)
var KiT_MetaData2D = kit.Types.AddType(&MetaData2D{}, nil)
var KiT_Node2DBase = kit.Types.AddType(&Node2DBase{}, Node2DBaseProps)
var KiT_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_PartsWidgetBase = kit.Types.AddType(&PartsWidgetBase{}, PartsWidgetBaseProps)
var KiT_Preferences = kit.Types.AddType(&Preferences{}, PreferencesProps)
var KiT_RowCol = kit.Enums.AddEnumAltLower(RowColN, false, StylePropProps, "")
var KiT_ScrollBar = kit.Types.AddType(&ScrollBar{}, ScrollBarProps)
var KiT_Separator = kit.Types.AddType(&Separator{}, SeparatorProps)
var KiT_Slider = kit.Types.AddType(&Slider{}, SliderProps)
var KiT_SliderBase = kit.Types.AddType(&SliderBase{}, SliderBaseProps)
var KiT_Space = kit.Types.AddType(&Space{}, SpaceProps)
var KiT_SpinBox = kit.Types.AddType(&SpinBox{}, SpinBoxProps)
var KiT_SplitView = kit.Types.AddType(&SplitView{}, SplitViewProps)
var KiT_Splitter = kit.Types.AddType(&Splitter{}, SplitterProps)
var KiT_Stretch = kit.Types.AddType(&Stretch{}, StretchProps)
var KiT_Stripes = kit.Enums.AddEnumAltLower(StripesN, false, StylePropProps, "Stripes")
var KiT_StyleSheet = kit.Types.AddType(&StyleSheet{}, nil)
var KiT_TextAnchors = kit.Enums.AddEnumAltLower(TextAnchorsN, false, StylePropProps, "Anchor")
var KiT_TextDecorations = kit.Enums.AddEnumAltLower(TextDecorationsN, true, StylePropProps, "Deco") // true = bit flag
var KiT_TextDirections = kit.Enums.AddEnumAltLower(TextDirectionsN, false, StylePropProps, "")
var KiT_TextField = kit.Types.AddType(&TextField{}, TextFieldProps)
var KiT_ToolBar = kit.Types.AddType(&ToolBar{}, ToolBarProps)
var KiT_UnicodeBidi = kit.Enums.AddEnumAltLower(UnicodeBidiN, false, StylePropProps, "Bidi")
var KiT_VectorEffect = kit.Enums.AddEnumAltLower(VecEffN, false, StylePropProps, "VecEff")
var KiT_Viewport2D = kit.Types.AddType(&Viewport2D{}, Viewport2DProps)
var KiT_WhiteSpaces = kit.Enums.AddEnumAltLower(WhiteSpacesN, false, StylePropProps, "WhiteSpace")
var KiT_WidgetBase = kit.Types.AddType(&WidgetBase{}, WidgetBaseProps)
var KiT_Window = kit.Types.AddType(&Window{}, nil)
var LabelProps = ki.Props{
    "white-space":      WhiteSpacePre,
    "padding":          units.NewValue(2, units.Px),
    "margin":           units.NewValue(2, units.Px),
    "vertical-align":   AlignTop,
    "color":            &Prefs.Colors.Font,
    "background-color": color.Transparent,
    LabelSelectors[LabelActive]: ki.Props{
        "background-color": color.Transparent,
    },
    LabelSelectors[LabelInactive]: ki.Props{
        "color": "lighter-50",
    },
    LabelSelectors[LabelSelected]: ki.Props{
        "background-color": &Prefs.Colors.Select,
    },
}
var LabelSelectors = []string{":active", ":inactive", ":selected"}

LabelSelectors are Style selector names for the different states:

var Layout2DTrace bool = false

Layout2DTrace can be set to true to obtain a trace of all layouts (just printfs to stdout)

var LayoutFields = initLayout()

LayoutFields contain the StyledFields for Layout type

var LayoutFocusNameTabMSec = 2000

LayoutFocusNameTabMSec is the number of milliseconds since last focus name event to allow tab to focus on next element with same name.

var LayoutFocusNameTimeoutMSec = 500

LayoutFocusNameTimeoutMSec is the number of milliseconds between keypresses to combine characters into name to search for within layout -- starts over after this delay.

var LocalMainMenu = false

LocalMainMenu controls whether the main menu is displayed locally at top of each window, in addition to the global menu at the top of the screen. Mac native apps do not do this, but OTOH it makes things more consistent with other platforms, and with larger screens, it can be convenient to have access to all the menu items right there. Controlled by Prefs.Params variable.

var Matrix2DProps = ki.Props{
    "style-prop": true,
}
var MenuBarProps = ki.Props{
    "padding":          units.NewValue(2, units.Px),
    "margin":           units.NewValue(0, units.Px),
    "spacing":          units.NewValue(4, units.Px),
    "color":            &Prefs.Colors.Font,
    "background-color": "linear-gradient(pref(Control), highlight-10)",
}
var MenuButtonProps = ki.Props{
    "border-width":     units.NewValue(1, units.Px),
    "border-radius":    units.NewValue(4, units.Px),
    "border-color":     &Prefs.Colors.Border,
    "border-style":     BorderSolid,
    "padding":          units.NewValue(4, units.Px),
    "margin":           units.NewValue(4, units.Px),
    "box-shadow.color": &Prefs.Colors.Shadow,
    "text-align":       AlignCenter,
    "background-color": &Prefs.Colors.Control,
    "color":            &Prefs.Colors.Font,
    "#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.Colors.Icon,
        "stroke":  &Prefs.Colors.Font,
    },
    "#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.Colors.Icon,
        "stroke":         &Prefs.Colors.Font,
    },
    "#ind-stretch": ki.Props{
        "width": units.NewValue(1, units.Em),
    },
    ButtonSelectors[ButtonActive]: ki.Props{
        "background-color": "linear-gradient(lighter-0, highlight-10)",
    },
    ButtonSelectors[ButtonInactive]: ki.Props{
        "border-color": "highlight-50",
        "color":        "highlight-50",
    },
    ButtonSelectors[ButtonHover]: ki.Props{
        "background-color": "linear-gradient(highlight-10, highlight-10)",
    },
    ButtonSelectors[ButtonFocus]: ki.Props{
        "border-width":     units.NewValue(2, units.Px),
        "background-color": "linear-gradient(samelight-50, highlight-10)",
    },
    ButtonSelectors[ButtonDown]: ki.Props{
        "color":            "highlight-90",
        "background-color": "linear-gradient(highlight-30, highlight-10)",
    },
    ButtonSelectors[ButtonSelected]: ki.Props{
        "background-color": "linear-gradient(pref(Select), highlight-10)",
    },
}
var MenuFrameProps = ki.Props{
    "border-width":        units.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.Colors.Shadow,
}
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 PartsWidgetBaseProps = ki.Props{
    "base-type": true,
}
var PreferencesProps = ki.Props{
    "MainMenu": ki.PropSlice{
        {"AppMenu", ki.BlankProp{}},
        {"File", ki.PropSlice{
            {"Update", ki.Props{
                "shortcut": "Command+U",
            }},
            {"Open", ki.Props{
                "shortcut": "Command+O",
            }},
            {"Save", ki.Props{
                "shortcut": "Command+S",
                "updtfunc": func(pfi interface{}, act *Action) {
                    pf := pfi.(*Preferences)
                    act.SetActiveState(pf.Changed)
                },
            }},
            {"sep-color", ki.BlankProp{}},
            {"OpenColors", ki.Props{
                "Args": ki.PropSlice{
                    {"Color File Name", ki.Props{
                        "default-field": "ColorFilename",
                        "ext":           ".json",
                    }},
                },
            }},
            {"SaveColors", ki.Props{
                "Args": ki.PropSlice{
                    {"Color File Name", ki.Props{
                        "default-field": "ColorFilename",
                        "ext":           ".json",
                    }},
                },
            }},
            {"sep-misc", ki.BlankProp{}},
            {"SaveZoom", ki.Props{
                "desc": "Save current zoom magnification factor, either for all screens or for the current screen only",
                "Args": ki.PropSlice{
                    {"For Current Screen Only?", ki.Props{
                        "desc": "click this to save zoom specifically for current screen",
                    }},
                },
            }},
            {"DeleteSavedWindowGeoms", ki.Props{
                "confirm": true,
                "desc":    "" /* 289 byte string literal not displayed */,
            }},
            {"sep-close", ki.BlankProp{}},
            {"Close Window", ki.BlankProp{}},
        }},
        {"Edit", "Copy Cut Paste"},
        {"Window", "Windows"},
    },
    "ToolBar": ki.PropSlice{
        {"Update", ki.Props{
            "desc": "Updates all open windows with current preferences -- triggers rebuild of default styles.",
            "icon": "update",
        }},
        {"sep-file", ki.BlankProp{}},
        {"Save", ki.Props{
            "desc": "Saves current preferences to standard prefs.json file, which is auto-loaded at startup.",
            "icon": "file-save",
            "updtfunc": func(pfi interface{}, act *Action) {
                pf := pfi.(*Preferences)
                act.SetActiveStateUpdt(pf.Changed)
            },
        }},
        {"sep-color", ki.BlankProp{}},
        {"Colors", ki.PropSlice{
            {"OpenColors", ki.Props{
                "icon": "file-open",
                "Args": ki.PropSlice{
                    {"Color File Name", ki.Props{
                        "default-field": "ColorFilename",
                        "ext":           ".json",
                    }},
                },
            }},
            {"SaveColors", ki.Props{
                "icon": "file-save",
                "Args": ki.PropSlice{
                    {"Color File Name", ki.Props{
                        "default-field": "ColorFilename",
                        "ext":           ".json",
                    }},
                },
            }},
        }},
        {"sep-scrn", ki.BlankProp{}},
        {"SaveZoom", ki.Props{
            "icon": "zoom-in",
            "desc": "Save current zoom magnification factor, either for all screens or for the current screen only",
            "Args": ki.PropSlice{
                {"For Current Screen Only?", ki.Props{
                    "desc": "click this to save zoom specifically for current screen",
                }},
            },
        }},
        {"ScreenInfo", ki.Props{
            "desc":        "shows parameters about all the active screens",
            "icon":        "info",
            "show-return": true,
        }},
        {"sep-key", ki.BlankProp{}},
        {"EditKeyMaps", ki.Props{
            "icon": "keyboard",
            "desc": "" /* 243 byte string literal not displayed */,
        }},
    },
}

PreferencesProps define the ToolBar and MenuBar for StructView, e.g., giv.PrefsView

var Prefs = Preferences{}

Prefs are the overall preferences

var PrefsFileName = "prefs.json"

PrefsFileName is the name of the preferences file in GoGi prefs directory

var PrefsKeyMapsFileName = "key_maps_prefs.json"

PrefsKeyMapsFileName is the name of the preferences file in GoGi prefs directory for saving / loading the default AvailKeyMaps key maps list

var RebuildDefaultStyles bool

RebuildDefaultStyles is a global state var used by Prefs to trigger rebuild of all the default styles, which are otherwise compiled and not updated

var Render2DTrace bool = false

Render2DTrace can be set to true to obtain a trace of the nodes rendering (just printfs to stdout)

var SavedPathsFileName = "saved_paths.json"

SavedPathsFileName is the name of the saved file paths file in GoGi prefs directory

var ScrollBarProps = ki.Props{
    "border-width":     units.NewValue(1, units.Px),
    "border-radius":    units.NewValue(4, units.Px),
    "border-color":     &Prefs.Colors.Border,
    "border-style":     BorderSolid,
    "padding":          units.NewValue(0, units.Px),
    "margin":           units.NewValue(2, units.Px),
    "background-color": &Prefs.Colors.Control,
    "color":            &Prefs.Colors.Font,
    SliderSelectors[SliderActive]: ki.Props{
        "background-color": "lighter-0",
    },
    SliderSelectors[SliderInactive]: ki.Props{
        "border-color": "highlight-50",
        "color":        "highlight-50",
    },
    SliderSelectors[SliderHover]: ki.Props{
        "background-color": "highlight-10",
    },
    SliderSelectors[SliderFocus]: ki.Props{
        "border-width":     units.NewValue(2, units.Px),
        "background-color": "samelight-50",
    },
    SliderSelectors[SliderDown]: ki.Props{
        "background-color": "highlight-20",
    },
    SliderSelectors[SliderValue]: ki.Props{
        "border-color":     &Prefs.Colors.Icon,
        "background-color": &Prefs.Colors.Icon,
    },
    SliderSelectors[SliderBox]: ki.Props{
        "border-color":     &Prefs.Colors.Background,
        "background-color": &Prefs.Colors.Background,
    },
}
var SeparatorProps = ki.Props{
    "padding":          units.NewValue(0, units.Px),
    "margin":           units.NewValue(0, units.Px),
    "vertical-align":   AlignCenter,
    "horizontal-align": AlignCenter,
    "border-color":     &Prefs.Colors.Border,
    "border-width":     units.NewValue(2, units.Px),
    "background-color": &Prefs.Colors.Control,
}
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.Colors.Border,
    "border-style":     BorderSolid,
    "padding":          units.NewValue(6, units.Px),
    "margin":           units.NewValue(4, units.Px),
    "background-color": &Prefs.Colors.Control,
    "color":            &Prefs.Colors.Font,
    "#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.Colors.Icon,
        "stroke":  &Prefs.Colors.Font,
    },
    SliderSelectors[SliderActive]: ki.Props{
        "background-color": "lighter-0",
    },
    SliderSelectors[SliderInactive]: ki.Props{
        "border-color": "highlight-50",
        "color":        "highlight-50",
    },
    SliderSelectors[SliderHover]: ki.Props{
        "background-color": "highlight-10",
    },
    SliderSelectors[SliderFocus]: ki.Props{
        "border-width":     units.NewValue(2, units.Px),
        "background-color": "samelight-50",
    },
    SliderSelectors[SliderDown]: ki.Props{
        "background-color": "highlight-20",
    },
    SliderSelectors[SliderValue]: ki.Props{
        "border-color":     &Prefs.Colors.Icon,
        "background-color": &Prefs.Colors.Icon,
    },
    SliderSelectors[SliderBox]: ki.Props{
        "border-color":     &Prefs.Colors.Background,
        "background-color": &Prefs.Colors.Background,
    },
}
var SliderSelectors = []string{":active", ":inactive", ":hover", ":focus", ":down", ":value", ":box"}

SliderSelectors are Style selector names for the different states

var SpaceProps = ki.Props{
    "width":  units.NewValue(1, units.Ch),
    "height": units.NewValue(1, units.Em),
}
var SpinBoxProps = ki.Props{
    "#buttons": ki.Props{
        "vertical-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.Colors.Icon,
        "stroke":     &Prefs.Colors.Font,
    },
    "#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.Colors.Icon,
        "stroke":     &Prefs.Colors.Font,
    },
    "#space": ki.Props{
        "width": units.NewValue(.1, units.Ch),
    },
    "#text-field": ki.Props{
        "min-width": units.NewValue(4, units.Ch),
        "width":     units.NewValue(8, units.Ch),
        "margin":    units.NewValue(2, units.Px),
        "padding":   units.NewValue(2, units.Px),
    },
}
var SplitViewProps = ki.Props{
    "handle-size": units.NewValue(10, units.Px),
    "max-width":   -1.0,
    "max-height":  -1.0,
    "margin":      0,
    "padding":     0,
}

auto-max-stretch

var SplitterProps = ki.Props{
    "padding":          units.NewValue(6, units.Px),
    "margin":           units.NewValue(0, units.Px),
    "background-color": &Prefs.Colors.Background,
    "color":            &Prefs.Colors.Font,
    "#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),
        "vertical-align": AlignMiddle,
        "fill":           &Prefs.Colors.Icon,
        "stroke":         &Prefs.Colors.Font,
    },
    SliderSelectors[SliderActive]: ki.Props{},
    SliderSelectors[SliderInactive]: ki.Props{
        "border-color": "highlight-50",
        "color":        "highlight-50",
    },
    SliderSelectors[SliderHover]: ki.Props{
        "background-color": "highlight-10",
    },
    SliderSelectors[SliderFocus]: ki.Props{
        "border-width":     units.NewValue(2, units.Px),
        "background-color": "samelight-50",
    },
    SliderSelectors[SliderDown]: ki.Props{},
    SliderSelectors[SliderValue]: ki.Props{
        "border-color":     &Prefs.Colors.Icon,
        "background-color": &Prefs.Colors.Icon,
    },
    SliderSelectors[SliderBox]: ki.Props{
        "border-color":     &Prefs.Colors.Background,
        "background-color": &Prefs.Colors.Background,
    },
}
var StdDialogVSpace = float32(1)

standard vertical space between elements in a dialog, in Ex units

var StdDialogVSpaceUnits = units.Value{Val: StdDialogVSpace, Un: units.Ex, Dots: 0}
var StdKeyMaps = KeyMaps{
    {"MacStd", "Standard Mac KeyMap", KeyMap{
        "UpArrow":                 KeyFunMoveUp,
        "Shift+UpArrow":           KeyFunMoveUp,
        "Meta+UpArrow":            KeyFunMoveUp,
        "Control+P":               KeyFunMoveUp,
        "Shift+Control+P":         KeyFunMoveUp,
        "Meta+Control+P":          KeyFunMoveUp,
        "DownArrow":               KeyFunMoveDown,
        "Shift+DownArrow":         KeyFunMoveDown,
        "Meta+DownArrow":          KeyFunMoveDown,
        "Control+N":               KeyFunMoveDown,
        "Shift+Control+N":         KeyFunMoveDown,
        "Meta+Control+N":          KeyFunMoveDown,
        "RightArrow":              KeyFunMoveRight,
        "Shift+RightArrow":        KeyFunMoveRight,
        "Meta+RightArrow":         KeyFunEnd,
        "Control+F":               KeyFunMoveRight,
        "Shift+Control+F":         KeyFunMoveRight,
        "Meta+Control+F":          KeyFunMoveRight,
        "LeftArrow":               KeyFunMoveLeft,
        "Shift+LeftArrow":         KeyFunMoveLeft,
        "Meta+LeftArrow":          KeyFunHome,
        "Control+B":               KeyFunMoveLeft,
        "Shift+Control+B":         KeyFunMoveLeft,
        "Meta+Control+B":          KeyFunMoveLeft,
        "Control+UpArrow":         KeyFunPageUp,
        "Control+U":               KeyFunPageUp,
        "Control+DownArrow":       KeyFunPageDown,
        "Shift+Control+V":         KeyFunPageDown,
        "Alt+√":                   KeyFunPageDown,
        "Control+RightArrow":      KeyFunWordRight,
        "Control+LeftArrow":       KeyFunWordLeft,
        "Alt+RightArrow":          KeyFunWordRight,
        "Alt+LeftArrow":           KeyFunWordLeft,
        "Home":                    KeyFunHome,
        "Control+A":               KeyFunHome,
        "End":                     KeyFunEnd,
        "Control+E":               KeyFunEnd,
        "Tab":                     KeyFunFocusNext,
        "Shift+Tab":               KeyFunFocusPrev,
        "ReturnEnter":             KeyFunSelectItem,
        "KeypadEnter":             KeyFunSelectItem,
        "Shift+Control+A":         KeyFunSelectAll,
        "Meta+A":                  KeyFunSelectAll,
        "Control+G":               KeyFunCancelSelect,
        "Control+Spacebar":        KeyFunSelectMode,
        "Control+ReturnEnter":     KeyFunAccept,
        "Escape":                  KeyFunAbort,
        "DeleteBackspace":         KeyFunBackspace,
        "Control+DeleteBackspace": KeyFunBackspaceWord,
        "Alt+DeleteBackspace":     KeyFunBackspaceWord,
        "DeleteForward":           KeyFunDelete,
        "Control+DeleteForward":   KeyFunDeleteWord,
        "Alt+DeleteForward":       KeyFunDeleteWord,
        "Control+D":               KeyFunDelete,
        "Control+H":               KeyFunBackspace,
        "Control+K":               KeyFunKill,
        "Alt+∑":                   KeyFunCopy,
        "Meta+C":                  KeyFunCopy,
        "Control+W":               KeyFunCut,
        "Meta+X":                  KeyFunCut,
        "Control+Y":               KeyFunPaste,
        "Control+V":               KeyFunPaste,
        "Meta+V":                  KeyFunPaste,
        "Control+M":               KeyFunDuplicate,
        "Control+Z":               KeyFunUndo,
        "Meta+Z":                  KeyFunUndo,
        "Shift+Control+Z":         KeyFunRedo,
        "Shift+Meta+Z":            KeyFunRedo,
        "Control+I":               KeyFunInsert,
        "Control+O":               KeyFunInsertAfter,
        "Control+Alt+I":           KeyFunGoGiEditor,
        "Control+Alt+E":           KeyFunGoGiEditor,
        "Shift+Control+I":         KeyFunGoGiEditor,
        "Shift+Meta+=":            KeyFunZoomIn,
        "Meta+=":                  KeyFunZoomIn,
        "Meta+-":                  KeyFunZoomOut,
        "Control+=":               KeyFunZoomIn,
        "Shift+Control++":         KeyFunZoomIn,
        "Shift+Meta+-":            KeyFunZoomOut,
        "Control+-":               KeyFunZoomOut,
        "Shift+Control+_":         KeyFunZoomOut,
        "Control+Alt+P":           KeyFunPrefs,
        "F5":                      KeyFunRefresh,
        "Control+L":               KeyFunRecenter,
        "Control+.":               KeyFunComplete,
    }},
    {"MacEmacs", "Mac with emacs-style navigation -- emacs wins in conflicts", KeyMap{
        "UpArrow":                 KeyFunMoveUp,
        "Shift+UpArrow":           KeyFunMoveUp,
        "Meta+UpArrow":            KeyFunMoveUp,
        "Control+P":               KeyFunMoveUp,
        "Shift+Control+P":         KeyFunMoveUp,
        "Meta+Control+P":          KeyFunMoveUp,
        "DownArrow":               KeyFunMoveDown,
        "Shift+DownArrow":         KeyFunMoveDown,
        "Meta+DownArrow":          KeyFunMoveDown,
        "Control+N":               KeyFunMoveDown,
        "Shift+Control+N":         KeyFunMoveDown,
        "Meta+Control+N":          KeyFunMoveDown,
        "RightArrow":              KeyFunMoveRight,
        "Shift+RightArrow":        KeyFunMoveRight,
        "Meta+RightArrow":         KeyFunEnd,
        "Control+F":               KeyFunMoveRight,
        "Shift+Control+F":         KeyFunMoveRight,
        "Meta+Control+F":          KeyFunMoveRight,
        "LeftArrow":               KeyFunMoveLeft,
        "Shift+LeftArrow":         KeyFunMoveLeft,
        "Meta+LeftArrow":          KeyFunHome,
        "Control+B":               KeyFunMoveLeft,
        "Shift+Control+B":         KeyFunMoveLeft,
        "Meta+Control+B":          KeyFunMoveLeft,
        "Control+UpArrow":         KeyFunPageUp,
        "Control+U":               KeyFunPageUp,
        "Control+DownArrow":       KeyFunPageDown,
        "Shift+Control+V":         KeyFunPageDown,
        "Alt+√":                   KeyFunPageDown,
        "Control+V":               KeyFunPageDown,
        "Control+RightArrow":      KeyFunWordRight,
        "Control+LeftArrow":       KeyFunWordLeft,
        "Alt+RightArrow":          KeyFunWordRight,
        "Alt+LeftArrow":           KeyFunWordLeft,
        "Home":                    KeyFunHome,
        "Control+A":               KeyFunHome,
        "End":                     KeyFunEnd,
        "Control+E":               KeyFunEnd,
        "Meta+Home":               KeyFunDocHome,
        "Meta+H":                  KeyFunDocHome,
        "Meta+L":                  KeyFunDocEnd,
        "Control+Alt+E":           KeyFunDocEnd,
        "Alt+F":                   KeyFunWordRight,
        "Alt+B":                   KeyFunWordLeft,
        "Tab":                     KeyFunFocusNext,
        "Shift+Tab":               KeyFunFocusPrev,
        "ReturnEnter":             KeyFunSelectItem,
        "KeypadEnter":             KeyFunSelectItem,
        "Shift+Control+A":         KeyFunSelectAll,
        "Meta+A":                  KeyFunSelectAll,
        "Control+G":               KeyFunCancelSelect,
        "Control+Spacebar":        KeyFunSelectMode,
        "Control+ReturnEnter":     KeyFunAccept,
        "Escape":                  KeyFunAbort,
        "DeleteBackspace":         KeyFunBackspace,
        "Control+DeleteBackspace": KeyFunBackspaceWord,
        "Alt+DeleteBackspace":     KeyFunBackspaceWord,
        "DeleteForward":           KeyFunDelete,
        "Control+DeleteForward":   KeyFunDeleteWord,
        "Alt+DeleteForward":       KeyFunDeleteWord,
        "Control+D":               KeyFunDelete,
        "Control+H":               KeyFunBackspace,
        "Control+K":               KeyFunKill,
        "Alt+∑":                   KeyFunCopy,
        "Meta+C":                  KeyFunCopy,
        "Control+W":               KeyFunCut,
        "Meta+X":                  KeyFunCut,
        "Control+Y":               KeyFunPaste,
        "Meta+V":                  KeyFunPaste,
        "Control+M":               KeyFunDuplicate,
        "Control+Z":               KeyFunUndo,
        "Meta+Z":                  KeyFunUndo,
        "Control+/":               KeyFunUndo,
        "Shift+Control+Z":         KeyFunRedo,
        "Shift+Meta+Z":            KeyFunRedo,
        "Control+I":               KeyFunInsert,
        "Control+O":               KeyFunInsertAfter,
        "Control+Alt+I":           KeyFunGoGiEditor,
        "Shift+Control+I":         KeyFunGoGiEditor,
        "Shift+Meta+=":            KeyFunZoomIn,
        "Meta+=":                  KeyFunZoomIn,
        "Meta+-":                  KeyFunZoomOut,
        "Control+=":               KeyFunZoomIn,
        "Shift+Control++":         KeyFunZoomIn,
        "Shift+Meta+-":            KeyFunZoomOut,
        "Control+-":               KeyFunZoomOut,
        "Shift+Control+_":         KeyFunZoomOut,
        "Control+Alt+P":           KeyFunPrefs,
        "F5":                      KeyFunRefresh,
        "Control+L":               KeyFunRecenter,
        "Control+.":               KeyFunComplete,
        "Control+S":               KeyFunSearch,
        "Meta+F":                  KeyFunFind,
        "Control+J":               KeyFunJump,
    }},
    {"LinuxStd", "Standard Linux KeyMap", KeyMap{
        "UpArrow": KeyFunMoveUp,

        "Shift+UpArrow": KeyFunMoveUp,
        "DownArrow":     KeyFunMoveDown,

        "Shift+DownArrow":  KeyFunMoveDown,
        "RightArrow":       KeyFunMoveRight,
        "Shift+RightArrow": KeyFunMoveRight,

        "LeftArrow":       KeyFunMoveLeft,
        "Shift+LeftArrow": KeyFunMoveLeft,

        "Control+UpArrow": KeyFunPageUp,

        "Control+DownArrow":  KeyFunPageDown,
        "Control+RightArrow": KeyFunWordRight,
        "Control+LeftArrow":  KeyFunWordLeft,
        "Home":               KeyFunHome,
        "Alt+LeftArrow":      KeyFunHome,
        "End":                KeyFunEnd,

        "Alt+RightArrow":  KeyFunEnd,
        "Tab":             KeyFunFocusNext,
        "Shift+Tab":       KeyFunFocusPrev,
        "ReturnEnter":     KeyFunSelectItem,
        "KeypadEnter":     KeyFunSelectItem,
        "Control+A":       KeyFunSelectAll,
        "Shift+Control+A": KeyFunCancelSelect,

        "Control+ReturnEnter":     KeyFunAccept,
        "Escape":                  KeyFunAbort,
        "DeleteBackspace":         KeyFunBackspace,
        "Control+DeleteBackspace": KeyFunBackspaceWord,
        "DeleteForward":           KeyFunDelete,

        "Control+K": KeyFunKill,
        "Control+C": KeyFunCopy,

        "Control+X":       KeyFunCut,
        "Control+V":       KeyFunPaste,
        "Control+M":       KeyFunDuplicate,
        "Control+Z":       KeyFunUndo,
        "Shift+Control+Z": KeyFunRedo,

        "Shift+Control+I": KeyFunGoGiEditor,
        "Control+=":       KeyFunZoomIn,
        "Shift+Control++": KeyFunZoomIn,
        "Control+-":       KeyFunZoomOut,
        "Shift+Control+_": KeyFunZoomOut,
        "Shift+Control+P": KeyFunPrefs,
        "Control+Alt+P":   KeyFunPrefs,
        "F5":              KeyFunRefresh,
        "Control+L":       KeyFunRecenter,
        "Control+.":       KeyFunComplete,
    }},
    {"LinuxEmacs", "Linux with emacs-style navigation -- emacs wins in conflicts", KeyMap{
        "UpArrow":            KeyFunMoveUp,
        "Shift+UpArrow":      KeyFunMoveUp,
        "Meta+UpArrow":       KeyFunMoveUp,
        "Control+P":          KeyFunMoveUp,
        "Shift+Control+P":    KeyFunMoveUp,
        "Meta+Control+P":     KeyFunMoveUp,
        "DownArrow":          KeyFunMoveDown,
        "Shift+DownArrow":    KeyFunMoveDown,
        "Meta+DownArrow":     KeyFunMoveDown,
        "Control+N":          KeyFunMoveDown,
        "Shift+Control+N":    KeyFunMoveDown,
        "Meta+Control+N":     KeyFunMoveDown,
        "RightArrow":         KeyFunMoveRight,
        "Shift+RightArrow":   KeyFunMoveRight,
        "Meta+RightArrow":    KeyFunEnd,
        "Control+F":          KeyFunMoveRight,
        "Shift+Control+F":    KeyFunMoveRight,
        "Meta+Control+F":     KeyFunMoveRight,
        "LeftArrow":          KeyFunMoveLeft,
        "Shift+LeftArrow":    KeyFunMoveLeft,
        "Meta+LeftArrow":     KeyFunHome,
        "Control+B":          KeyFunMoveLeft,
        "Shift+Control+B":    KeyFunMoveLeft,
        "Meta+Control+B":     KeyFunMoveLeft,
        "Control+UpArrow":    KeyFunPageUp,
        "Control+U":          KeyFunPageUp,
        "Control+DownArrow":  KeyFunPageDown,
        "Shift+Control+V":    KeyFunPageDown,
        "Alt+√":              KeyFunPageDown,
        "Control+RightArrow": KeyFunWordRight,
        "Control+LeftArrow":  KeyFunWordLeft,
        "Home":               KeyFunHome,
        "Control+A":          KeyFunHome,
        "Shift+Control+A":    KeyFunHome,
        "Alt+LeftArrow":      KeyFunHome,
        "End":                KeyFunEnd,
        "Control+E":          KeyFunEnd,
        "Shift+Control+E":    KeyFunEnd,
        "Alt+RightArrow":     KeyFunEnd,
        "Tab":                KeyFunFocusNext,
        "Shift+Tab":          KeyFunFocusPrev,
        "ReturnEnter":        KeyFunSelectItem,
        "KeypadEnter":        KeyFunSelectItem,

        "Meta+A":                  KeyFunSelectAll,
        "Control+G":               KeyFunCancelSelect,
        "Control+Spacebar":        KeyFunSelectMode,
        "Control+ReturnEnter":     KeyFunAccept,
        "Escape":                  KeyFunAbort,
        "DeleteBackspace":         KeyFunBackspace,
        "Control+DeleteBackspace": KeyFunBackspaceWord,
        "DeleteForward":           KeyFunDelete,
        "Control+D":               KeyFunDelete,
        "Control+H":               KeyFunBackspace,
        "Control+K":               KeyFunKill,
        "Alt+∑":                   KeyFunCopy,
        "Control+C":               KeyFunCopy,
        "Meta+C":                  KeyFunCopy,
        "Control+W":               KeyFunCut,
        "Control+X":               KeyFunCut,
        "Meta+X":                  KeyFunCut,
        "Control+Y":               KeyFunPaste,
        "Control+V":               KeyFunPaste,
        "Meta+V":                  KeyFunPaste,
        "Control+M":               KeyFunDuplicate,
        "Control+I":               KeyFunInsert,
        "Control+O":               KeyFunInsertAfter,
        "Control+Alt+I":           KeyFunGoGiEditor,
        "Control+Alt+E":           KeyFunGoGiEditor,
        "Shift+Control+I":         KeyFunGoGiEditor,
        "Shift+Meta+=":            KeyFunZoomIn,
        "Meta+=":                  KeyFunZoomIn,
        "Meta+-":                  KeyFunZoomOut,
        "Control+=":               KeyFunZoomIn,
        "Shift+Control++":         KeyFunZoomIn,
        "Shift+Meta+-":            KeyFunZoomOut,
        "Control+-":               KeyFunZoomOut,
        "Shift+Control+_":         KeyFunZoomOut,
        "Control+Alt+P":           KeyFunPrefs,
        "F5":                      KeyFunRefresh,
        "Control+L":               KeyFunRecenter,
        "Control+.":               KeyFunComplete,
        "Control+S":               KeyFunSearch,
        "Meta+F":                  KeyFunFind,
        "Control+J":               KeyFunJump,
    }},
    {"WindowsStd", "Standard Windows KeyMap", KeyMap{
        "UpArrow": KeyFunMoveUp,

        "Shift+UpArrow": KeyFunMoveUp,
        "DownArrow":     KeyFunMoveDown,

        "Shift+DownArrow":  KeyFunMoveDown,
        "RightArrow":       KeyFunMoveRight,
        "Shift+RightArrow": KeyFunMoveRight,

        "LeftArrow":       KeyFunMoveLeft,
        "Shift+LeftArrow": KeyFunMoveLeft,

        "Control+UpArrow": KeyFunPageUp,

        "Control+DownArrow":  KeyFunPageDown,
        "Control+RightArrow": KeyFunWordRight,
        "Control+LeftArrow":  KeyFunWordLeft,
        "Home":               KeyFunHome,
        "Alt+LeftArrow":      KeyFunHome,
        "End":                KeyFunEnd,

        "Alt+RightArrow":  KeyFunEnd,
        "Tab":             KeyFunFocusNext,
        "Shift+Tab":       KeyFunFocusPrev,
        "ReturnEnter":     KeyFunSelectItem,
        "KeypadEnter":     KeyFunSelectItem,
        "Control+A":       KeyFunSelectAll,
        "Shift+Control+A": KeyFunCancelSelect,

        "Control+ReturnEnter":     KeyFunAccept,
        "Escape":                  KeyFunAbort,
        "DeleteBackspace":         KeyFunBackspace,
        "Control+DeleteBackspace": KeyFunBackspaceWord,
        "DeleteForward":           KeyFunDelete,

        "Control+K": KeyFunKill,
        "Control+C": KeyFunCopy,

        "Control+X": KeyFunCut,
        "Control+V": KeyFunPaste,
        "Control+M": KeyFunDuplicate,

        "Shift+Control+I": KeyFunGoGiEditor,
        "Control+=":       KeyFunZoomIn,
        "Shift+Control++": KeyFunZoomIn,
        "Control+-":       KeyFunZoomOut,
        "Shift+Control+_": KeyFunZoomOut,
        "Shift+Control+P": KeyFunPrefs,
        "Control+Alt+P":   KeyFunPrefs,
        "F5":              KeyFunRefresh,
        "Control+L":       KeyFunRecenter,
        "Control+.":       KeyFunComplete,
    }},
    {"ChromeStd", "Standard chrome-browser and linux-under-chrome bindings", KeyMap{
        "UpArrow": KeyFunMoveUp,

        "Shift+UpArrow": KeyFunMoveUp,
        "DownArrow":     KeyFunMoveDown,

        "Shift+DownArrow":  KeyFunMoveDown,
        "RightArrow":       KeyFunMoveRight,
        "Shift+RightArrow": KeyFunMoveRight,

        "LeftArrow":       KeyFunMoveLeft,
        "Shift+LeftArrow": KeyFunMoveLeft,

        "Control+UpArrow": KeyFunPageUp,

        "Control+DownArrow":  KeyFunPageDown,
        "Control+RightArrow": KeyFunWordRight,
        "Control+LeftArrow":  KeyFunWordLeft,
        "Home":               KeyFunHome,
        "Alt+LeftArrow":      KeyFunHome,
        "End":                KeyFunEnd,

        "Alt+RightArrow":  KeyFunEnd,
        "Tab":             KeyFunFocusNext,
        "Shift+Tab":       KeyFunFocusPrev,
        "ReturnEnter":     KeyFunSelectItem,
        "KeypadEnter":     KeyFunSelectItem,
        "Control+A":       KeyFunSelectAll,
        "Shift+Control+A": KeyFunCancelSelect,

        "Control+ReturnEnter":     KeyFunAccept,
        "Escape":                  KeyFunAbort,
        "DeleteBackspace":         KeyFunBackspace,
        "Control+DeleteBackspace": KeyFunBackspaceWord,
        "DeleteForward":           KeyFunDelete,

        "Control+K": KeyFunKill,
        "Control+C": KeyFunCopy,

        "Control+X": KeyFunCut,
        "Control+V": KeyFunPaste,
        "Control+M": KeyFunDuplicate,

        "Shift+Control+I": KeyFunGoGiEditor,
        "Control+=":       KeyFunZoomIn,
        "Shift+Control++": KeyFunZoomIn,
        "Control+-":       KeyFunZoomOut,
        "Shift+Control+_": KeyFunZoomOut,
        "Shift+Control+P": KeyFunPrefs,
        "Control+Alt+P":   KeyFunPrefs,
        "F5":              KeyFunRefresh,
        "Control+L":       KeyFunRecenter,
        "Control+.":       KeyFunComplete,
    }},
}

StdKeyMaps is the original compiled-in set of standard keymaps that have the lastest key functions bound to standard key chords.

var StretchProps = ki.Props{
    "max-width":  -1.0,
    "max-height": -1.0,
}
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 StyleValueTypes = map[reflect.Type]struct{}{
    units.KiT_Value: {},
    KiT_Color:       {},
    KiT_ColorSpec:   {},
    KiT_Matrix2D:    {},
}

StyleValueTypes is a map of types that are used as value types in style structures

var TextFieldBlinker *time.Ticker

TextFieldBlinker is the time.Ticker for blinking cursors for text fields, only one of which can be active at at a time

var TextFieldProps = ki.Props{
    "border-width":     units.NewValue(1, units.Px),
    "cursor-width":     units.NewValue(3, units.Px),
    "border-color":     &Prefs.Colors.Border,
    "border-style":     BorderSolid,
    "padding":          units.NewValue(4, units.Px),
    "margin":           units.NewValue(1, units.Px),
    "text-align":       AlignLeft,
    "color":            &Prefs.Colors.Font,
    "background-color": &Prefs.Colors.Control,
    TextFieldSelectors[TextFieldActive]: ki.Props{
        "background-color": "lighter-0",
    },
    TextFieldSelectors[TextFieldFocus]: ki.Props{
        "border-width":     units.NewValue(2, units.Px),
        "background-color": "samelight-80",
    },
    TextFieldSelectors[TextFieldInactive]: ki.Props{
        "background-color": "highlight-10",
    },
    TextFieldSelectors[TextFieldSel]: ki.Props{
        "background-color": &Prefs.Colors.Select,
    },
}
var TextFieldSelectors = []string{":active", ":focus", ":inactive", ":selected"}

Style selector names for the different states

var TextFieldSpriteName = "gi.TextField.Cursor"

TextFieldSpriteName is the name of the window sprite used for the cursor

var TextFontRenderMu sync.Mutex

TextFontRenderMu mutex is required because multiple different goroutines associated with different windows can (and often will be) call font stuff at the same time (curFace.GyphAdvance, rendering font) at the same time, on the same font face -- and that turns out not to work!

var ToolBarProps = ki.Props{
    "padding":          units.NewValue(2, units.Px),
    "margin":           units.NewValue(0, units.Px),
    "spacing":          units.NewValue(4, units.Px),
    "color":            &Prefs.Colors.Font,
    "background-color": "linear-gradient(pref(Control), highlight-10)",
}
var TooltipFrameProps = ki.Props{
    "background-color":    &Prefs.Colors.Highlight,
    "border-width":        units.NewValue(0, units.Px),
    "border-color":        "none",
    "margin":              units.NewValue(0, units.Px),
    "padding":             units.NewValue(2, units.Px),
    "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.Colors.Shadow,
}
var URLHandler = func(url string) bool {
    oswin.TheApp.OpenURL(url)
    return true
}

URLHandler is used to handle URL links, if non-nil -- set this to your own handler to process URL's, depending on TextLinkHandler -- the default version of this function just calls oswin.TheApp.OpenURL -- setting this to nil will prevent any links from being open that way, and your own function will have full responsibility for links if set (i.e., the return value is ignored)

var Update2DTrace bool = false

Update2DTrace can be set to true to obtain a trace of updates that trigger re-rendering

var Vec2DZero = Vec2D{0, 0}
var Viewport2DProps = ki.Props{
    "color":            &Prefs.Colors.Font,
    "background-color": &Prefs.Colors.Background,
}
var WidgetBaseProps = ki.Props{
    "base-type": true,
}
var WidgetDefPropsKey = "__DefProps"

WidgetDefPropsKey is the key for accessing the default style properties stored in the type-properties for a given type -- also ones with sub-selectors for parts in there with selector appended to this key

var WidgetDefStyleKey = "__DefStyle"

WidgetDefStyleKey is the key for accessing the default style stored in the type-properties for a given type -- also ones with sub-selectors for parts in there with selector appended to this key

var WinGeomPrefs = WindowGeomPrefs{}
var WinGeomPrefsFileName = "win_geom_prefs.json"

WinGeomPrefsFileName is the name of the preferences file in GoGi prefs directory

var WinNewCloseTime time.Time

WinNewCloseTime records last time a new window was opened or another closed -- used to trigger updating of Window menus on each window.

var WinWait sync.WaitGroup

WinWait is a wait group for waiting for all the open window event loops to finish -- this can be used for cases where the initial main run uses a GoStartEventLoop for example. It is incremented by GoStartEventLoop and decremented when the event loop terminates.

var ZoomFactor = float32(1.0)

ZoomFactor is a temporary multiplier on LogicalDPI used for per-session display zooming without changing prefs -- see SaveZoom to save prefs with this current factor.

func AbsInt Uses

func AbsInt(a int) int

func AggCSS Uses

func AggCSS(agg *ki.Props, css ki.Props)

AggCSS aggregates css properties

func ChoiceDialog Uses

func ChoiceDialog(avp *Viewport2D, opts DlgOpts, choices []string, recv ki.Ki, fun ki.RecvFunc)

ChoiceDialog presents any number of buttons with labels as given, for the user to choose among -- the clicked button number (starting at 0) will be sent to the receiving object and function for dialog signals. Viewport is optional to properly contextualize dialog to given master window.

func CopyGradient Uses

func CopyGradient(dst, src *rasterx.Gradient)

CopyGradient copies a gradient, making new copies of the stops instead of re-using pointers

func DNDModCursor Uses

func DNDModCursor(dmod dnd.DropMods) cursor.Shapes

DNDModCursor gets the appropriate cursor based on the DND event mod.

func DNDNotCursor Uses

func DNDNotCursor()

DNDNotCursor sets the cursor to Not = can't accept a drop

func DNDSetCursor Uses

func DNDSetCursor(dmod dnd.DropMods)

DNDSetCursor sets the cursor based on the DND event mod -- does a "PushIfNot" so safe for multiple calls.

func DNDUpdateCursor Uses

func DNDUpdateCursor(dmod dnd.DropMods) bool

DNDUpdateCursor updates the cursor based on the curent DND event mod if different from current (but no update if Not)

func Degrees Uses

func Degrees(radians float32) float32

func FindEllipseCenter Uses

func FindEllipseCenter(rx, ry *float32, rotX, startX, startY, endX, endY float32, sweep, largeArc bool) (cx, cy float32)

FindEllipseCenter locates the center of the Ellipse if it exists. If it does not exist, the radius values will be increased minimally for a solution to be possible while preserving the rx to rb ratio. rx and rb arguments are pointers that can be checked after the call to see if the values changed. This method uses coordinate transformations to reduce the problem to finding the center of a circle that includes the origin and an arbitrary point. The center of the circle is then transformed back to the original coordinates and returned.

func FixFontMods Uses

func FixFontMods(fn string) string

FixFontMods ensures that standard font modifiers have a space in front of them, and that the default is not in the name -- used for regularizing font names.

func FixGradientStops Uses

func FixGradientStops(grad *rasterx.Gradient)

FixGradientStops applies the CSS rules to regularize the gradient stops: https://www.w3.org/TR/css3-images/#color-stop-syntax

func FixedToFloat Uses

func FixedToFloat(x fixed.Int26_6) float64

func FixedToFloat32 Uses

func FixedToFloat32(x fixed.Int26_6) float32

func Float32ToFixed Uses

func Float32ToFixed(x float32) fixed.Int26_6

func Float32ToFixedPoint Uses

func Float32ToFixedPoint(x, y float32) fixed.Point26_6

func FloatMod Uses

func FloatMod(val, mod float64) float64

FloatMod ensures that a floating point value is an even multiple of a given value

func FloatMod32 Uses

func FloatMod32(val, mod float32) float32

FloatMod ensures that a floating point value is an even multiple of a given value

func FontAlts Uses

func FontAlts(fams string) (fns []string, serif, mono bool)

FontAlts generates a list of all possible alternative fonts that actually exist in font library for a list of font families, and a guess as to whether the font is a serif (vs sans) or monospaced (vs proportional) font. Only deals with base names.

func FontFaceName Uses

func FontFaceName(fam string, str FontStretch, wt FontWeights, sty FontStyles) string

FontFaceName returns the best full FaceName to use for the given font family(ies) (comma separated) and modifier parameters

func FontNameFromMods Uses

func FontNameFromMods(basenm string, str FontStretch, wt FontWeights, sty FontStyles) string

FontNameFromMods generates the appropriate regularized file name based on base name and modifiers

func FontNameToMods Uses

func FontNameToMods(fn string) (basenm string, str FontStretch, wt FontWeights, sty FontStyles)

FontNameToMods parses the regularized font name and returns the appropriate base name and associated font mods.

func FontSerifMonoGuess Uses

func FontSerifMonoGuess(fns []string) (serif, mono bool)

FontSerifMonoGuess looks at a list of alternative font names and tires to guess if the font is a serif (vs sans) or monospaced (vs proportional) font.

func HSLtoRGBf32 Uses

func HSLtoRGBf32(h, s, l float32) (r, g, b float32)

HSLtoRGBf32 converts HSL values to RGB float32 0..1 values (non alpha-premultiplied) -- based on https://stackoverflow.com/questions/2353211/hsl-to-rgb-color-conversion, https://www.w3.org/TR/css-color-3/ and github.com/lucasb-eyer/go-colorful

func ImageClearer Uses

func ImageClearer(im *image.RGBA, pct float32)

ImageClearer makes an image more transparent -- pct is amount to alter alpha transparency factor by -- 100 = fully transparent, 0 = no change -- affects the image itself -- make a copy of you want to keept the original or see bild/blend/multiply -- this is specifically used for gi DND etc

func InRange Uses

func InRange(val, min, max float64) float64

InRange returns the value constrained to the min / max range

func InRange32 Uses

func InRange32(val, min, max float32) float32

InRange32 returns the value constrained to the min / max range

func InRangeInt Uses

func InRangeInt(val, min, max int) int

InRangeInt returns the value constrained to the min / max range

func Init Uses

func Init()

Init performs overall initialization of the gogi system: loading prefs, etc -- automatically called when new window opened, but can be called before then if pref info needed.

func IsAlignEnd Uses

func IsAlignEnd(a Align) bool

is this a generalized alignment to end of container?

func IsAlignMiddle Uses

func IsAlignMiddle(a Align) bool

is this a generalized alignment to middle of container?

func IsAlignStart Uses

func IsAlignStart(a Align) bool

is this a generalized alignment to start of container?

func KiToNode2D Uses

func KiToNode2D(k ki.Ki) (Node2D, *Node2DBase)

KiToNode2D converts Ki to a Node2D interface and a Node2DBase obj -- nil if not.

func MainMenuFunc(owin oswin.Window, title string, tag int)

MainMenuFunc is the callback function for OS-generated menu actions.

func Max32 Uses

func Max32(a, b float32) float32

func MaxInt Uses

func MaxInt(a, b int) int

func Min32 Uses

func Min32(a, b float32) float32

func MinInt Uses

func MinInt(a, b int) int

func MinPos Uses

func MinPos(a, b float64) float64

MinPos returns the minimum of the two values, excluding any that are 0

func MinPos32 Uses

func MinPos32(a, b float32) float32

MinPos32 returns the minimum of the two values, excluding any that are 0

func NewKiDialogValues Uses

func NewKiDialogValues(dlg *Dialog) (int, reflect.Type)

NewKiDialogValues gets the user-set values from a NewKiDialog.

func NextRuneAt Uses

func NextRuneAt(str string, idx int) rune

NextRuneAt returns the next rune starting from given index -- could be at that index or some point thereafter -- returns utf8.RuneError if no valid rune could be found -- this should be a standard function!

func OpenFontFace Uses

func OpenFontFace(path string, size int, strokeWidth int) (font.Face, error)

OpenFontFace loads a font file at given path, with given raw size in display dots, and if strokeWidth is > 0, the font is drawn in outline form (stroked) instead of filled (supported in SVG).

func OpenGoFont Uses

func OpenGoFont(path string, size int, strokeWidth int) (font.Face, error)

func OpenImage Uses

func OpenImage(path string) (image.Image, error)

func OpenPNG Uses

func OpenPNG(path string) (image.Image, error)

func OpenPaths Uses

func OpenPaths()

OpenPaths loads the active SavedPaths from prefs dir

func ParseAngle32 Uses

func ParseAngle32(pstr string) (float32, error)

ParseAngle32 returns radians angle from string that can specify units (deg, grad, rad) -- deg is assumed if not specified

func ParseDashesString Uses

func ParseDashesString(str string) []float64

ParseDashesString gets a dash slice from given string

func ParseFloat32 Uses

func ParseFloat32(pstr string) (float32, error)

ParseFloat32 logs any strconv.ParseFloat errors

func PointsCheckN Uses

func PointsCheckN(pts []float32, n int, errmsg string) error

PointsCheckN checks the number of points read and emits an error if not equal to n

func PopupIsCompleter Uses

func PopupIsCompleter(pop ki.Ki) bool

PopupIsCompleter returns true if the given popup item is a menu and a completer

func PopupIsMenu Uses

func PopupIsMenu(pop ki.Ki) bool

PopupIsMenu returns true if the given popup item is a menu

func PopupIsTooltip Uses

func PopupIsTooltip(pop ki.Ki) bool

PopupIsTooltip returns true if the given popup item is a menu

func PromptDialog Uses

func PromptDialog(avp *Viewport2D, opts DlgOpts, 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). Viewport is optional to properly contextualize dialog to given master window.

func RGBtoHSLf32 Uses

func RGBtoHSLf32(r, g, b float32) (h, s, l float32)

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 Radians Uses

func Radians(degrees float32) float32

func ReadPoints Uses

func ReadPoints(pstr string) []float32

ReadPoints reads a set of floating point values from a SVG format number string -- returns a slice or nil if there was an error

func RectFromPosSizeMax Uses

func RectFromPosSizeMax(pos, sz Vec2D) image.Rectangle

RectFromPosSizeMax returns an image.Rectangle from max dims of pos, size (floor on pos, ceil on size)

func RectFromPosSizeMin Uses

func RectFromPosSizeMin(pos, sz Vec2D) image.Rectangle

RectFromPosSizeMin returns an image.Rectangle from min dims of pos, size (ceil on pos, floor on size)

func SavePNG Uses

func SavePNG(path string, im image.Image) error

func SavePaths Uses

func SavePaths()

SavePaths saves the active SavedPaths to prefs dir

func SetActiveKeyMap Uses

func SetActiveKeyMap(km *KeyMap)

SetActiveKeyMap sets the current ActiveKeyMap, calling Update on the map prior to setting it to ensure that it is a valid, complete map

func SetActiveKeyMapName Uses

func SetActiveKeyMapName(mapnm KeyMapName)

SetActiveKeyMapName sets the current ActiveKeyMap by name from those defined in AvailKeyMaps, calling Update on the map prior to setting it to ensure that it is a valid, complete map

func SetCurStyleNode2D Uses

func SetCurStyleNode2D(node Node2D)

SetCurStyleNode2D sets the current styling node to given node, or nil when done

func SetGradientBounds Uses

func SetGradientBounds(grad *rasterx.Gradient, bounds image.Rectangle)

SetGradientBounds sets bounds of the gradient

func SetHTMLSimpleTag Uses

func SetHTMLSimpleTag(tag string, fs *FontStyle, ctxt *units.Context, cssAgg ki.Props) bool

SetHTMLSimpleTag sets the styling parameters for simple html style tags that only require updating the given font spec values -- returns true if handled https://www.w3schools.com/cssref/css_default_values.asp

func SetMax32 Uses

func SetMax32(a *float32, b float32)

SetMax32 sets arg a to Max(a,b)

func SetMin32 Uses

func SetMin32(a *float32, b float32)

SetMin32 sets arg a to Min(a,b)

func SetStylePropsXML Uses

func SetStylePropsXML(style string, props *ki.Props)

SetStylePropsXML sets style props from XML style string, which contains ';' separated name: value pairs

func SignalViewport2D Uses

func SignalViewport2D(vpki, send ki.Ki, sig int64, data interface{})

SignalViewport2D is called by each node in scenegraph through its UpdateSig signal to notify its parent viewport whenever it changes, causing a re-render.

func SignalWindowPublish Uses

func SignalWindowPublish(winki, node ki.Ki, sig int64, data interface{})

SignalWindowPublish is the signal receiver function that publishes the window updates when the window update signal (UpdateEnd) occurs

func StringPromptDialogValue Uses

func StringPromptDialogValue(dlg *Dialog) string

StringPromptValue gets the string value the user set.

func StyleEffTag Uses

func StyleEffTag(tag, outerTag string) string

get the full effective tag based on outer tag plus given tag

func SubProps Uses

func SubProps(prp ki.Props, selector string) (ki.Props, bool)

SubProps returns a sub-property map from given prop map for a given styling selector (property name) -- e.g., :normal :active :hover etc -- returns false if not found

func TextFieldBlink()

TextFieldBlink is function that blinks text field cursor

func ToLabel Uses

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 Uses

func Truncate(val float64, prec int) float64

Truncate a floating point number to given level of precision -- slow.. uses string conversion

func Truncate32 Uses

func Truncate32(val float32, prec int) float32

Truncate a floating point number to given level of precision -- slow.. uses string conversion

func WalkStyleStruct Uses

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

func WinNewCloseStamp Uses

func WinNewCloseStamp()

func XMLAttr Uses

func XMLAttr(name string, attrs []xml.Attr) string

XMLAttr searches for given attribute in slice of xml attributes -- returns "" if not found

type ActOpts Uses

type ActOpts struct {
    Label      string
    Icon       string
    Tooltip    string
    Shortcut   key.Chord
    Data       interface{}
    UpdateFunc func(act *Action)
}

ActOpts provides named and partial parameters for AddAction method

type Action Uses

type Action struct {
    ButtonBase
    Data       interface{}       `json:"-" xml:"-" view:"-" desc:"optional data that is sent with the ActionSig when it is emitted"`
    ActionSig  ki.Signal         `json:"-" xml:"-" view:"-" desc:"signal for action -- does not have a signal type, as there is only one type: Action triggered -- data is Data of this action"`
    UpdateFunc func(act *Action) `json:"-" xml:"-" view:"-" desc:"optional function that is called to update state of action (typically updating Active state) -- called automatically for menus prior to showing"`
}

Action is a button widget that can display a text label and / or an icon and / or a keyboard shortcut -- this is what is put in menus, menubars, and toolbars, and also for any standalone simple action. The default styling differs depending on whether it is in a Menu versus a MenuBar or ToolBar -- this is controlled by the Class which is automatically set to menu-action or bar-action.

func (*Action) ButtonAsBase Uses

func (ac *Action) ButtonAsBase() *ButtonBase

func (*Action) ButtonRelease Uses

func (ac *Action) ButtonRelease()

trigger action signal

func (*Action) ConfigParts Uses

func (ac *Action) ConfigParts()

func (*Action) ConfigPartsAddShortcut Uses

func (ac *Action) ConfigPartsAddShortcut(config *kit.TypeAndNameList) int

ConfigPartsAddShortcut adds a menu shortcut, with a stretch space -- only called when needed

func (*Action) ConfigPartsButton Uses

func (ac *Action) ConfigPartsButton()

func (*Action) ConfigPartsMenuItem Uses

func (ac *Action) ConfigPartsMenuItem()

func (*Action) ConfigPartsShortcut Uses

func (ac *Action) ConfigPartsShortcut(scIdx int)

func (*Action) Init2D Uses

func (ac *Action) Init2D()

func (*Action) Trigger Uses

func (ac *Action) Trigger()

Trigger triggers the action signal -- for external activation of action -- only works if action is not inactive

func (*Action) UpdateActions Uses

func (ac *Action) UpdateActions()

UpdateActions calls UpdateFunc on me and any of my menu items

type Align Uses

type Align int32

Align has all different types of alignment -- only some are applicable to different contexts, but there is also so much overlap that it makes sense to have them all in one list -- some are not standard CSS and used by layout

const (
    AlignLeft Align = iota
    AlignTop
    AlignCenter
    // middle = vertical version of center
    AlignMiddle
    AlignRight
    AlignBottom
    AlignBaseline
    // same as CSS space-between
    AlignJustify
    AlignSpaceAround
    AlignFlexStart
    AlignFlexEnd
    AlignTextTop
    AlignTextBottom
    // align to subscript
    AlignSub
    // align to superscript
    AlignSuper
    AlignN
)

func (*Align) FromString Uses

func (i *Align) FromString(s string) error

func (Align) MarshalJSON Uses

func (ev Align) MarshalJSON() ([]byte, error)

func (Align) String Uses

func (i Align) String() string

func (*Align) UnmarshalJSON Uses

func (ev *Align) UnmarshalJSON(b []byte) error

type BaselineShifts Uses

type BaselineShifts int32

BaselineShifts are for super / sub script

const (
    ShiftBaseline BaselineShifts = iota
    ShiftSuper
    ShiftSub
    BaselineShiftsN
)

func (*BaselineShifts) FromString Uses

func (i *BaselineShifts) FromString(s string) error

func (BaselineShifts) MarshalJSON Uses

func (ev BaselineShifts) MarshalJSON() ([]byte, error)

func (BaselineShifts) String Uses

func (i BaselineShifts) String() string

func (*BaselineShifts) UnmarshalJSON Uses

func (ev *BaselineShifts) UnmarshalJSON(b []byte) error

type Bitmap Uses

type Bitmap struct {
    Viewport2D
}

Bitmap is a Viewport2D that is optimized to render a static bitmap image -- it expects to be a terminal node and does NOT call rendering etc on its children. It is particularly useful for overlays in drag-n-drop uses -- can grab the image of another vp and show that

func (*Bitmap) GrabRenderFrom Uses

func (bm *Bitmap) GrabRenderFrom(nii Node2D) bool

GrabRenderFrom grabs the rendered image from given node -- copies the vpBBox from parent viewport of node (or from viewport directly if node is a viewport) -- returns success

func (*Bitmap) Render2D Uses

func (bm *Bitmap) Render2D()

type BorderDrawStyle Uses

type BorderDrawStyle int32

BorderDrawStyle determines how to draw the border

const (
    BorderSolid BorderDrawStyle = iota
    BorderDotted
    BorderDashed
    BorderDouble
    BorderGroove
    BorderRidge
    BorderInset
    BorderOutset
    BorderNone
    BorderHidden
    BorderN
)

func (*BorderDrawStyle) FromString Uses

func (i *BorderDrawStyle) FromString(s string) error

func (BorderDrawStyle) MarshalJSON Uses

func (ev BorderDrawStyle) MarshalJSON() ([]byte, error)

func (BorderDrawStyle) String Uses

func (i BorderDrawStyle) String() string

func (*BorderDrawStyle) UnmarshalJSON Uses

func (ev *BorderDrawStyle) UnmarshalJSON(b []byte) error

type BorderStyle Uses

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"`
}

BorderStyle contains style parameters for borders

type BoxSides Uses

type BoxSides int32

BoxSides specifies sides of a box -- some properties can be specified per each side (e.g., border) or not

const (
    BoxTop BoxSides = iota
    BoxRight
    BoxBottom
    BoxLeft
    BoxN
)

func (*BoxSides) FromString Uses

func (i *BoxSides) FromString(s string) error

func (BoxSides) MarshalJSON Uses

func (ev BoxSides) MarshalJSON() ([]byte, error)

func (BoxSides) String Uses

func (i BoxSides) String() string

func (*BoxSides) UnmarshalJSON Uses

func (ev *BoxSides) UnmarshalJSON(b []byte) error

type Button Uses

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 Uses

func (bb *Button) ButtonAsBase() *ButtonBase

type ButtonBase Uses

type ButtonBase struct {
    PartsWidgetBase
    Text         string               `xml:"text" desc:"label for the button -- if blank then no label is presented"`
    Icon         IconName             `xml:"icon" view:"show-name" desc:"optional icon for the button -- different buttons can configure this in different ways relative to the text if both are present"`
    Indicator    IconName             `xml:"indicator" view:"show-name" desc:"name of the menu indicator icon to present, or blank or 'nil' or 'none' -- shown automatically when there are Menu elements present unless 'none' is set"`
    Shortcut     key.Chord            `xml:"shortcut" desc:"optional shortcut keyboard chord to trigger this action -- always window-wide in scope, and should generally not conflict other shortcuts (a log message will be emitted if so).  Shortcuts are processed after all other processing of keyboard input.  Use Command for Control / Meta (Mac Command key) per platform"`
    StateStyles  [ButtonStatesN]Style `json:"-" xml:"-" desc:"styles for different states of the button, one for each state -- everything inherits from the base Style which is styled first according to the user-set styles, and then subsequent style settings can override that"`
    State        ButtonStates         `json:"-" xml:"-" desc:"current state of the button based on gui interaction"`
    ButtonSig    ki.Signal            `json:"-" xml:"-" view:"-" desc:"signal for button -- see ButtonSignals for the types"`
    Menu         Menu                 `desc:"the menu items for this menu -- typically add Action elements for menus, along with separators"`
    MakeMenuFunc MakeMenuFunc         `json:"-" xml:"-" view:"-" 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

func (*ButtonBase) ButtonAsBase Uses

func (bb *ButtonBase) ButtonAsBase() *ButtonBase

func (*ButtonBase) ButtonEnterHover Uses

func (bb *ButtonBase) ButtonEnterHover()

ButtonEnterHover called when button starting hover

func (*ButtonBase) ButtonEvents Uses

func (bb *ButtonBase) ButtonEvents()

func (*ButtonBase) ButtonExitHover Uses

func (bb *ButtonBase) ButtonExitHover()

ButtonExitHover called when button exiting hover

func (*ButtonBase) ButtonPressed Uses

func (bb *ButtonBase) ButtonPressed()

ButtonPressed sets the button in the down state -- mouse clicked down but not yet up -- emits ButtonPressed signal AND WidgetSig Selected signal -- ButtonClicked is down and up

func (*ButtonBase) ButtonRelease Uses

func (bb *ButtonBase) ButtonRelease()

func (*ButtonBase) ButtonReleased Uses

func (bb *ButtonBase) ButtonReleased()

ButtonReleased action: the button has just been released -- sends a released signal and returns state to normal, and emits clicked signal if if it was previously in pressed state

func (*ButtonBase) ConfigParts Uses

func (bb *ButtonBase) ConfigParts()

func (*ButtonBase) ConfigPartsAddIndicator Uses

func (bb *ButtonBase) ConfigPartsAddIndicator(config *kit.TypeAndNameList, defOn bool) int

ConfigPartsAddIndicator adds a menu indicator if there is a menu present, and the Indicator field is not "none" -- defOn = true means default to adding the indicator even if no menu is yet present -- returns the index in Parts of the indicator object, which is named "indicator" -- an "ind-stretch" is added as well to put on the right by default.

func (*ButtonBase) ConfigPartsIfNeeded Uses

func (bb *ButtonBase) ConfigPartsIfNeeded()

func (*ButtonBase) ConfigPartsIndicator Uses

func (bb *ButtonBase) ConfigPartsIndicator(indIdx int)

func (*ButtonBase) ConnectEvents2D Uses

func (bb *ButtonBase) ConnectEvents2D()

func (*ButtonBase) FocusChanged2D Uses

func (bb *ButtonBase) FocusChanged2D(change FocusChanges)

func (*ButtonBase) HasMenu Uses

func (bb *ButtonBase) HasMenu() bool

HasMenu returns true if there is a menu or menu-making function set, or the explicit ButtonFlagMenu has been set

func (*ButtonBase) Init2D Uses

func (bb *ButtonBase) Init2D()

func (*ButtonBase) IsCheckable Uses

func (bb *ButtonBase) IsCheckable() bool

IsCheckable returns if is this button checkable -- the Checked state is independent of the generic widget selection state

func (*ButtonBase) IsChecked Uses

func (bb *ButtonBase) IsChecked() bool

IsChecked checks if button is checked

func (*ButtonBase) IsMenu Uses

func (bb *ButtonBase) IsMenu() bool

IsMenu returns true this button is on a menu -- it is a menu item

func (*ButtonBase) KeyChordEvent Uses

func (bb *ButtonBase) KeyChordEvent()

KeyChordEvent handles button KeyChord events

func (*ButtonBase) Label Uses

func (bb *ButtonBase) Label() string

Label returns the display label for this node, satisfying the Labeler interface

func (*ButtonBase) Layout2D Uses

func (bb *ButtonBase) Layout2D(parBBox image.Rectangle, iter int) bool

func (*ButtonBase) MouseEvent Uses

func (bb *ButtonBase) MouseEvent()

MouseEvents handles button MouseEvent

func (*ButtonBase) MouseFocusEvent Uses

func (bb *ButtonBase) MouseFocusEvent()

MouseFocusEvents handles button MouseFocusEvent

func (*ButtonBase) OpenMenu Uses

func (bb *ButtonBase) OpenMenu() bool

OpenMenu will open any menu associated with this element -- returns true if menu opened, false if not

func (*ButtonBase) Render2D Uses

func (bb *ButtonBase) Render2D()

func (*ButtonBase) ResetMenu Uses

func (bb *ButtonBase) ResetMenu()

ResetMenu removes all items in the menu

func (*ButtonBase) SetAsButton Uses

func (bb *ButtonBase) SetAsButton()

SetAsButton clears the explicit ButtonFlagMenu -- if there are menu items or a menu function then it will still behave as a menu

func (*ButtonBase) SetAsMenu Uses

func (bb *ButtonBase) SetAsMenu()

SetAsMenu ensures that this functions as a menu even before menu items are added

func (*ButtonBase) SetButtonState Uses

func (bb *ButtonBase) SetButtonState(state ButtonStates) bool

SetButtonState sets the button state -- returns true if state changed

func (*ButtonBase) SetCheckable Uses

func (bb *ButtonBase) SetCheckable(checkable bool)

SetCheckable sets whether this button is checkable -- emits ButtonToggled signals if so -- the Checked state is independent of the generic widget selection state

func (*ButtonBase) SetChecked Uses

func (bb *ButtonBase) SetChecked(chk bool)

SetChecked sets the checked state of this button -- does not emit signal or update

func (*ButtonBase) SetIcon Uses

func (bb *ButtonBase) SetIcon(iconName string)

SetIcon sets the Icon to given icon name (could be empty or 'none') and updates the button

func (*ButtonBase) SetText Uses

func (bb *ButtonBase) SetText(txt string)

SetText sets the text and updates the button

func (*ButtonBase) Style2D Uses

func (bb *ButtonBase) Style2D()

func (*ButtonBase) StyleButton Uses

func (bb *ButtonBase) StyleButton()

func (*ButtonBase) StyleParts Uses

func (bb *ButtonBase) StyleParts()

func (*ButtonBase) ToggleChecked Uses

func (bb *ButtonBase) ToggleChecked()

ToggleChecked toggles the checked state of this button -- does not emit signal or update

func (*ButtonBase) UpdateButtonStyle Uses

func (bb *ButtonBase) UpdateButtonStyle() bool

UpdateButtonStyle sets the button style based on current state info -- returns true if changed -- restyles parts if so

type ButtonSignals Uses

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 Uses

func (i *ButtonSignals) FromString(s string) error

func (ButtonSignals) String Uses

func (i ButtonSignals) String() string

type ButtonStates Uses

type ButtonStates int32

mutually-exclusive button states -- determines appearance

const (
    // normal active state -- there but not being interacted with
    ButtonActive ButtonStates = iota

    // inactive -- not pressable -- no events
    ButtonInactive

    // mouse is hovering over the button
    ButtonHover

    // button is the focus -- will respond to keyboard input
    ButtonFocus

    // button is currently being pressed down
    ButtonDown

    // button has been selected -- selection is a general widget property used
    // by views and other complex widgets -- checked state is independent of this
    ButtonSelected

    // total number of button states
    ButtonStatesN
)

func (*ButtonStates) FromString Uses

func (i *ButtonStates) FromString(s string) error

func (ButtonStates) MarshalJSON Uses

func (ev ButtonStates) MarshalJSON() ([]byte, error)

func (ButtonStates) String Uses

func (i ButtonStates) String() string

func (*ButtonStates) UnmarshalJSON Uses

func (ev *ButtonStates) UnmarshalJSON(b []byte) error

type ButtonWidget Uses

type ButtonWidget interface {
    // ButtonAsBase gets the button base for most basic functions -- reduces
    // interface size.
    ButtonAsBase() *ButtonBase

    // ButtonRelease is called for release of button -- this is where buttons
    // actually differ in functionality.
    ButtonRelease()

    // StyleParts is called during Style2D to handle stying associated with
    // parts -- icons mainly.
    StyleParts()

    // ConfigParts configures the parts of the button -- called during init
    // and style.
    ConfigParts()

    // ConfigPartsIfNeeded configures the parts of the button, only if needed
    // -- called during layout and render
    ConfigPartsIfNeeded()
}

ButtonWidget is an interface for button widgets allowing ButtonBase defaults to handle most cases.

type CheckBox Uses

type CheckBox struct {
    ButtonBase
    IconOff IconName `xml:"icon-off" view:"show-name" desc:"icon to use for the off, unchecked state of the icon -- plain Icon holds the On state -- can be set with icon-off property"`
}

CheckBox toggles between a checked and unchecked state

func (*CheckBox) ButtonAsBase Uses

func (cb *CheckBox) ButtonAsBase() *ButtonBase

func (*CheckBox) ButtonRelease Uses

func (cb *CheckBox) ButtonRelease()

func (*CheckBox) ConfigParts Uses

func (cb *CheckBox) ConfigParts()

func (*CheckBox) ConfigPartsIfNeeded Uses

func (cb *CheckBox) ConfigPartsIfNeeded()

func (*CheckBox) Init2D Uses

func (cb *CheckBox) Init2D()

func (*CheckBox) SetIconProps Uses

func (cb *CheckBox) SetIconProps(props ki.Props)

SetIconProps sets the icon properties from given property list -- parent types can use this to set different icon properties

func (*CheckBox) SetIcons Uses

func (cb *CheckBox) SetIcons(icOn, icOff string)

SetIcons sets the Icons (by name) for the On (checked) and Off (unchecked) states, and updates button

func (*CheckBox) StyleParts Uses

func (cb *CheckBox) StyleParts()

type Color Uses

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 CurrentColor Color

CurrentColor is automatically updated from the Color setting of a Style and accessible as a color name in any other style as currentColor

var NilColor Color

func ColorFromString Uses

func ColorFromString(str string, base color.Color) (Color, error)

ColorFromString returns a new color set from given string and optional base color for transforms -- see SetString

func (*Color) Blend Uses

func (c *Color) Blend(pct float32, clr color.Color) Color

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 Uses

func (c *Color) Clearer(pct float32) Color

Clearer returns a color that is given percent more transparent (lower alpha value) relative to current alpha level

func (*Color) Darker Uses

func (c *Color) Darker(pct float32) Color

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) Highlight Uses

func (c *Color) Highlight(pct float32) Color

Highlight returns a color that is either lighter or darker by the given percent, e.g., 50 = 50% change relative to maximum possible lightness, depending on how light the color is already -- if lightness > 50% then goes darker, and vice-versa

func (*Color) IsBlack Uses

func (c *Color) IsBlack() bool

IsBlack checks if color is a full opaque black color

func (*Color) IsNil Uses

func (c *Color) IsNil() bool

IsNil checks if color is the nil initial default color -- a = 0 means fully transparent black

func (*Color) IsWhite Uses

func (c *Color) IsWhite() bool

IsWhite checks if color is a full opaque white color

func (*Color) Lighter Uses

func (c *Color) Lighter(pct float32) Color

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 Uses

func (c *Color) Opaquer(pct float32) Color

Opaquer returns a color that is given percent more opaque (higher alpha value) relative to current alpha level

func (*Color) ParseHex Uses

func (c *Color) ParseHex(x string) error

parse Hex color -- this is from fogelman/gg I think..

func (*Color) Pastel Uses

func (c *Color) Pastel(pct float32) Color

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) RGBA Uses

func (c Color) RGBA() (r, g, b, a uint32)

implements color.Color interface -- returns values in range 0x0000 - 0xffff

func (*Color) Samelight Uses

func (c *Color) Samelight(pct float32) Color

Samelight is the opposite of Highlight -- makes a color darker if already darker than 50%, and lighter if already lighter than 50%

func (*Color) Saturate Uses

func (c *Color) Saturate(pct float32) Color

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) SetColor Uses

func (c *Color) SetColor(ci color.Color)

func (*Color) SetFloat32 Uses

func (c *Color) SetFloat32(r, g, b, a float32)

Convert from 0-1 normalized floating point numbers

func (*Color) SetFloat64 Uses

func (c *Color) SetFloat64(r, g, b, a float64)

Convert from 0-1 normalized floating point numbers

func (*Color) SetHSL Uses

func (c *Color) SetHSL(h, s, l float32)

Convert from HSL: [0..360], Saturation [0..1], and Luminance (lightness) [0..1] of the color using float32 values

func (*Color) SetHSLA Uses

func (c *Color) SetHSLA(h, s, l, a float32)

Convert from HSLA: [0..360], Saturation [0..1], and Luminance (lightness) [0..1] of the color using float32 values

func (*Color) SetInt Uses

func (c *Color) SetInt(r, g, b, a int)

func (*Color) SetNPFloat32 Uses

func (c *Color) SetNPFloat32(r, g, b, a float32)

Convert from 0-1 normalized floating point numbers, non alpha-premultiplied

func (*Color) SetString Uses

func (c *Color) SetString(str string, base color.Color) error

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) SetToNil Uses

func (c *Color) SetToNil()

func (*Color) SetUInt32 Uses

func (c *Color) SetUInt32(r, g, b, a uint32)

func (*Color) SetUInt8 Uses

func (c *Color) SetUInt8(r, g, b, a uint8)

func (*Color) String Uses

func (c *Color) String() string

func (Color) ToFloat32 Uses

func (c Color) ToFloat32() (r, g, b, a float32)

Convert to 0-1 normalized floating point numbers, still alpha-premultiplied

func (*Color) ToHSLA Uses

func (c *Color) ToHSLA() (h, s, l, a float32)

Convert to HSLA: [0..360], Saturation [0..1], and Luminance (lightness) [0..1] of the color using float32 values

func (Color) ToNPFloat32 Uses

func (c Color) ToNPFloat32() (r, g, b, a float32)

Convert to 0-1 normalized floating point numbers, not alpha premultiplied

type ColorPrefs Uses

type ColorPrefs struct {
    Font       Color `desc:"default font / pen color"`
    Background Color `desc:"default background color"`
    Shadow     Color `desc:"color for shadows -- should generally be a darker shade of the background color"`
    Border     Color `desc:"default border color, for button, frame borders, etc"`
    Control    Color `desc:"default main color for controls: buttons, etc"`
    Icon       Color `desc:"color for icons or other solidly-colored, small elements"`
    Select     Color `desc:"color for selected elements"`
    Highlight  Color `desc:"color for highlight background"`
    Link       Color `desc:"color for links in text etc"`
}

ColorPrefs specify colors for all major categories of GUI elements, and are used in the default styles.

func (*ColorPrefs) Defaults Uses

func (pf *ColorPrefs) Defaults()

func (*ColorPrefs) OpenJSON Uses

func (pf *ColorPrefs) OpenJSON(filename FileName) error

OpenJSON opens colors from a JSON-formatted file.

func (*ColorPrefs) PrefColor Uses

func (pf *ColorPrefs) PrefColor(clrName string) *Color

PrefColor returns preference color of given name (case insensitive)

func (*ColorPrefs) SaveJSON Uses

func (pf *ColorPrefs) SaveJSON(filename FileName) error

SaveJSON saves colors to a JSON-formatted file.

type ColorSources Uses

type ColorSources int32

ColorSources determine how the color is generated -- used in FillStyle and StrokeStyle

const (
    SolidColor ColorSources = iota
    LinearGradient
    RadialGradient
    ColorSourcesN
)

func (*ColorSources) FromString Uses

func (i *ColorSources) FromString(s string) error

func (ColorSources) MarshalJSON Uses

func (ev ColorSources) MarshalJSON() ([]byte, error)

func (ColorSources) String Uses

func (i ColorSources) String() string

func (*ColorSources) UnmarshalJSON Uses

func (ev *ColorSources) UnmarshalJSON(b []byte) error

type ColorSpec Uses

type ColorSpec struct {
    Source   ColorSources      `desc:"source of color (solid, gradient)"`
    Color    Color             `desc:"color for solid color source"`
    Gradient *rasterx.Gradient `desc:"gradient parameters for gradient color source"`
}

ColorSpec fully specifies the color for rendering -- used in FillStyle and StrokeStyle

func (*ColorSpec) ColorOrNil Uses

func (cs *ColorSpec) ColorOrNil() color.Color

ColorOrNil returns the solid color if non-nil, or nil otherwise -- for consumers that handle nil colors

func (*ColorSpec) CopyFrom Uses

func (cs *ColorSpec) CopyFrom(cp *ColorSpec)

Copy copies a gradient, making new copies of the stops instead of re-using pointers

func (*ColorSpec) IsNil Uses

func (cs *ColorSpec) IsNil() bool

IsNil tests for nil solid or gradient colors

func (*ColorSpec) ReadGradAttr Uses

func (cs *ColorSpec) ReadGradAttr(attr xml.Attr) (err error)

func (*ColorSpec) ReadXML Uses

func (cs *ColorSpec) ReadXML(reader io.Reader) error

ReadXML reads XML-formatted ColorSpec from io.Reader

func (*ColorSpec) RenderColor Uses

func (cs *ColorSpec) RenderColor(opacity float32, bounds image.Rectangle, xform Matrix2D) interface{}

RenderColor gets the color for rendering, applying opacity and bounds for gradients

func (*ColorSpec) SetColor Uses

func (cs *ColorSpec) SetColor(cl color.Color)

SetColor sets a solid color

func (*ColorSpec) SetShadowGradient Uses

func (cs *ColorSpec) SetShadowGradient(cl color.Color, dir string)

SetShadowGradient sets a linear gradient starting at given color and going down to transparent based on given color and direction spec (defaults to "to down")

func (*ColorSpec) SetString Uses

func (cs *ColorSpec) SetString(clrstr string) bool

SetString sets the color spec from a standard CSS-formatted string -- see https://www.w3schools.com/css/css3_gradients.asp -- see UnmarshalXML for XML-based version

func (*ColorSpec) UnmarshalXML Uses

func (cs *ColorSpec) UnmarshalXML(decoder *xml.Decoder, se xml.StartElement) error

UnmarshalXML parses the given XML-formatted string to set the color specification

type ComboBox Uses

type ComboBox struct {
    ButtonBase
    Editable  bool          `xml:"editable" desc:"provide a text field for editing the value, or just a button for selecting items?  Set the editable property"`
    CurVal    interface{}   `json:"-" xml:"-" desc:"current selected value"`
    CurIndex  int           `json:"-" xml:"-" desc:"current index in list of possible items"`
    Items     []interface{} `json:"-" xml:"-" desc:"items available for selection"`
    ItemsMenu Menu          `json:"-" xml:"-" desc:"the menu of actions for selecting items -- automatically generated from Items"`
    ComboSig  ki.Signal     `json:"-" xml:"-" view:"-" desc:"signal for combo box, when a new value has been selected -- the signal type is the index of the selected item, and the data is the value"`
    MaxLength int           `desc:"maximum label length (in runes)"`
}

func (*ComboBox) ButtonAsBase Uses

func (cb *ComboBox) ButtonAsBase() *ButtonBase

func (*ComboBox) ButtonRelease Uses

func (cb *ComboBox) ButtonRelease()

func (*ComboBox) ConfigParts Uses

func (cb *ComboBox) ConfigParts()

func (*ComboBox) ConfigPartsIconText Uses

func (cb *ComboBox) ConfigPartsIconText(icnm string) (config kit.TypeAndNameList, icIdx, txIdx int)

ConfigPartsIconText returns a standard config for creating parts, of icon and text left-to right in a row -- always makes text

func (*ComboBox) ConfigPartsIfNeeded Uses

func (cb *ComboBox) ConfigPartsIfNeeded()

func (*ComboBox) ConfigPartsSetText Uses

func (cb *ComboBox) ConfigPartsSetText(txt string, txIdx, icIdx int)

ConfigPartsSetText sets part style props, using given props if not set in object props

func (*ComboBox) FindItem Uses

func (cb *ComboBox) FindItem(it interface{}) int

FindItem finds an item on list of items and returns its index

func (*ComboBox) ItemsFromEnum Uses

func (cb *ComboBox) ItemsFromEnum(enumtyp reflect.Type, setFirst bool, maxLen int)

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 Uses

func (cb *ComboBox) ItemsFromEnumList(el []kit.EnumValue, setFirst bool, maxLen int)

ItemsFromEnumList sets the Items list from a list of enum values (see kit.EnumRegistry) -- if setFirst then set current item to the first item in the list, and maxLen if > 0 auto-sets the width of the button to the contents, with the given upper limit

func (*ComboBox) ItemsFromStringList Uses

func (cb *ComboBox) ItemsFromStringList(el []string, setFirst bool, maxLen int)

ItemsFromStringList sets the Items list from a list of string values -- if setFirst then set current item to the first item in the list, and maxLen if > 0 auto-sets the width of the button to the contents, with the given upper limit

func (*ComboBox) ItemsFromTypes Uses

func (cb *ComboBox) ItemsFromTypes(tl []reflect.Type, setFirst, sort bool, maxLen int)

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 Uses

func (cb *ComboBox) MakeItems(reset bool, capacity int)

MakeItems makes sure the Items list is made, and if not, or reset is true, creates one with the given capacity

func (*ComboBox) MakeItemsMenu Uses

func (cb *ComboBox) MakeItemsMenu()

MakeItemsMenu makes menu of all the items

func (*ComboBox) SelectItem Uses

func (cb *ComboBox) SelectItem(idx int)

SelectItem selects a given item and emits the index as the ComboSig signal and the selected item as the data

func (*ComboBox) SetCurIndex Uses

func (cb *ComboBox) SetCurIndex(idx int) interface{}

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 Uses

func (cb *ComboBox) SetCurVal(it interface{}) int

SetCurVal sets the current value (CurVal) and the corresponding CurIndex for that item on the current Items list (adds to items list if not found) -- returns that index -- and sets the text to the string value of that value (using standard Stringer string conversion)

func (*ComboBox) SetToMaxLength Uses

func (cb *ComboBox) SetToMaxLength(maxLen int)

SetToMaxLength gets the maximum label length so that the width of the button label is automatically set according to the max length of all items in the list -- if maxLen > 0 then it is used as an upper do-not-exceed length

func (*ComboBox) SortItems Uses

func (cb *ComboBox) SortItems(ascending bool)

SortItems sorts the items according to their labels

func (*ComboBox) TextField Uses

func (cb *ComboBox) TextField() (*TextField, bool)

TextField returns the text field of an editable combobox, and false if not made

type Complete Uses

type Complete struct {
    ki.Node
    MatchFunc   complete.MatchFunc `desc:"function to get the list of possible completions"`
    EditFunc    complete.EditFunc  `desc:"function to edit text using the selected completion"`
    Context     interface{}        `desc:"the object that implements complete.Func"`
    Completions complete.Completions
    Seed        string    `desc:"current completion seed"`
    CompleteSig ki.Signal `json:"-" xml:"-" view:"-" desc:"signal for complete -- see CompleteSignals for the types"`
    Completion  string    `desc:"the user's completion selection'"`
}

Complete holds the current completion data and functions to call for building the list of possible completions and for editing text after a completion is selected

func (*Complete) Complete Uses

func (c *Complete) Complete(s string)

Complete emits a signal to let subscribers know that the user has made a selection from the list of possible completions

func (*Complete) KeyInput Uses

func (c *Complete) KeyInput(kf KeyFuns)

KeyInput is the opportunity for completion to act on specific key inputs

func (*Complete) ShowCompletions Uses

func (c *Complete) ShowCompletions(text string, pos token.Position, vp *Viewport2D, pt image.Point)

ShowCompletions calls MatchFunc to get a list of completions and builds the completion popup menu

type CompleteSignals Uses

type CompleteSignals int64

CompleteSignals are signals that are sent by Complete

const (
    // CompleteSelect means the user chose one of the possible completions
    CompleteSelect CompleteSignals = iota

    // CompleteExtend means user has requested that the seed extend if all
    // completions have a common prefix longer than current seed
    CompleteExtend
)

func (*CompleteSignals) FromString Uses

func (i *CompleteSignals) FromString(s string) error

func (CompleteSignals) String Uses

func (i CompleteSignals) String() string

type CtxtMenuFunc Uses

type CtxtMenuFunc func(g Node2D, m *Menu)

CtxtMenuFunc is a function for creating a context menu for given node

type Dialog Uses

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"`
    SigVal    int64       `desc:"signal value that will be sent, if >= 0 (by default, DialogAccepted or DialogCanceled will be sent for standard Ok / Cancel buttons)"`
    DialogSig ki.Signal   `json:"-" xml:"-" view:"-" 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 NewKiDialog Uses

func NewKiDialog(avp *Viewport2D, iface reflect.Type, opts DlgOpts, recv ki.Ki, fun ki.RecvFunc) *Dialog

NewKiDialog prompts for creating new item(s) of a given type, showing types that implement given interface -- use construct of form: reflect.TypeOf((*gi.Node2D)(nil)).Elem() to get the interface type. Optionally connects to given signal receiving object and function for dialog signals (nil to ignore).

func NewStdDialog Uses

func NewStdDialog(opts DlgOpts, ok, cancel bool) *Dialog

NewStdDialog returns a basic standard dialog with given options (title, prompt, CSS styling) and whether ok, cancel buttons should be shown -- any empty text will not be added -- returns with UpdateStart started but NOT ended -- must call UpdateEnd(true) once done configuring!

func StringPromptDialog Uses

func StringPromptDialog(avp *Viewport2D, strval, placeholder string, opts DlgOpts, recv ki.Ki, fun ki.RecvFunc) *Dialog

StringPromptDialog prompts the user for a string value -- optionally connects to given signal receiving object and function for dialog signals (nil to ignore). Viewport is optional to properly contextualize dialog to given master window.

func (*Dialog) Accept Uses

func (dlg *Dialog) Accept()

Accept accepts the dialog, activated by the default Ok button

func (*Dialog) AddButtonBox Uses

func (dlg *Dialog) AddButtonBox(frame *Frame) *Layout

AddButtonBox adds a button box (Row Layout) named "buttons" to given frame, with an extra space above it

func (*Dialog) ButtonBox Uses

func (dlg *Dialog) ButtonBox(frame *Frame) (*Layout, int)

ButtonBox returns the ButtonBox layout widget, and its index, within frame -- nil, -1 if not found

func (*Dialog) Cancel Uses

func (dlg *Dialog) Cancel()

Cancel cancels the dialog, activated by the default Cancel button

func (*Dialog) Close Uses

func (dlg *Dialog) Close()

Close requests that the dialog be closed -- it does not alter any state or send any signals

func (*Dialog) Frame Uses

func (dlg *Dialog) Frame() *Frame

Frame returns the main frame for the dialog, assumed to be the first element in the dialog

func (*Dialog) HasFocus2D Uses

func (dlg *Dialog) HasFocus2D() bool

func (*Dialog) Init2D Uses

func (dlg *Dialog) Init2D()

func (*Dialog) Open Uses

func (dlg *Dialog) Open(x, y int, avp *Viewport2D, cfgFunc func()) bool

Open this dialog, in given location (0 = middle of window), finding window from given viewport -- returns false if it fails for any reason. optional cvgFunc can perform additional configuration after the dialog window has been created and dialog added to it -- some configs require the window.

func (*Dialog) PromptWidget Uses

func (dlg *Dialog) PromptWidget(frame *Frame) (*Label, int)

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 Uses

func (dlg *Dialog) SetFrame() *Frame

SetFrame creates a standard vertical column frame layout as first element of the dialog, named "frame"

func (*Dialog) SetPrompt Uses

func (dlg *Dialog) SetPrompt(prompt string, frame *Frame) *Label

SetPrompt sets the prompt and adds a Label named "prompt" to the given frame layout if passed

func (*Dialog) SetTitle Uses

func (dlg *Dialog) SetTitle(title string, frame *Frame) *Label

SetTitle sets the title and adds a Label named "title" to the given frame layout if passed

func (*Dialog) StdButtonConfig Uses

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 Uses

func (dlg *Dialog) StdButtonConnect(ok, cancel bool, bb *Layout)

StdButtonConnnect connects standard buttons in given button box layout to Accept / Cancel actions

func (*Dialog) StdDialog Uses

func (dlg *Dialog) StdDialog(title, prompt string, ok, cancel bool)

StdDialog configures a basic standard dialog with a title, prompt, and ok / cancel buttons -- any empty text will not be added

func (*Dialog) TitleWidget Uses

func (dlg *Dialog) TitleWidget(frame *Frame) (*Label, int)

Title returns the title label widget, and its index, within frame -- nil, -1 if not found

type DialogState Uses

type DialogState int64

DialogState indicates the state of the dialog.

const (
    // DialogExists is the existential state -- struct exists and is likely
    // being constructed.
    DialogExists DialogState = iota

    // DialogOpenModal means dialog is open in a modal state, blocking all other input.
    DialogOpenModal

    // DialogOpenModeless means dialog is open in a modeless state, allowing other input.
    DialogOpenModeless

    // DialogAccepted means Ok was pressed -- dialog accepted.
    DialogAccepted

    // DialogCanceled means Cancel was pressed -- button canceled.
    DialogCanceled

    DialogStateN
)

func (*DialogState) FromString Uses

func (i *DialogState) FromString(s string) error

func (DialogState) String Uses

func (i DialogState) String() string

type Dims2D Uses

type Dims2D int32

dimensions

const (
    X   Dims2D = iota
    Y
    Dims2DN
)

func OtherDim Uses

func OtherDim(d Dims2D) Dims2D

get the other dimension

func (*Dims2D) FromString Uses

func (i *Dims2D) FromString(s string) error

func (Dims2D) MarshalJSON Uses

func (ev Dims2D) MarshalJSON() ([]byte, error)

func (Dims2D) String Uses

func (i Dims2D) String() string

func (*Dims2D) UnmarshalJSON Uses

func (ev *Dims2D) UnmarshalJSON(b []byte) error

type DlgOpts Uses

type DlgOpts struct {
    Title  string   `desc:"generally should be provided -- will also be used for setting name of dialog and associated window"`
    Prompt string   `desc:"optional more detailed description of what is being requested and how it will be used -- is word-wrapped and can contain full html formatting etc."`
    CSS    ki.Props `desc:"optional style properties applied to dialog -- can be used to customize any aspect of existing dialogs"`
}

DlgOpts are the basic dialog options accepted by all dialog methods -- provides a named, optional way to specify these args

type EventPris Uses

type EventPris int32

EventPris for different queues of event signals, processed in priority order

const (
    // HiPri = high priority -- event receivers processed first -- can be used
    // to override default behavior
    HiPri EventPris = iota

    // RegPri = default regular priority -- most should be here
    RegPri

    // LowPri = low priority -- processed last -- typically for containers /
    // dialogs etc
    LowPri

    // LowRawPri = unfiltered (raw) low priority -- ignores whether the event
    // was already processed.
    LowRawPri

    EventPrisN

    // AllPris = -1 = all priorities (for delete cases only)
    AllPris EventPris = -1
)

func StringToEventPris Uses

func StringToEventPris(s string) (EventPris, error)

func (EventPris) String Uses

func (i EventPris) String() string

type FavPathItem Uses

type FavPathItem struct {
    Ic   IconName `desc:"icon for item"`
    Name string   `width:"20" desc:"name of the favorite item"`
    Path string   `tableview:"-select"`
}

FavPathItem represents one item in a favorite path list, for display of favorites. Is an ordered list instead of a map because user can organize in order

type FavPaths Uses

type FavPaths []FavPathItem

FavPaths is a list (slice) of favorite path items

func (*FavPaths) FindPath Uses

func (pf *FavPaths) FindPath(path string) (int, bool)

FindPath returns index of path on list, or -1, false if not found

func (*FavPaths) SetToDefaults Uses

func (pf *FavPaths) SetToDefaults()

SetToDefaults sets the paths to default values

type FileName Uses

type FileName string

FileName is used to specify an filename (including path) -- automtically opens the FileView dialog using ValueView system. Use this for any method args that are filenames to trigger use of FileViewDialog under MethView automatic method calling.

type FilePaths Uses

type FilePaths []string
var SavedPaths FilePaths

func (*FilePaths) AddPath Uses

func (pf *FilePaths) AddPath(path string, max int)

AddPath inserts a path to the file paths (at the start), subject to max length -- if path is already on the list then it is moved to the start.

func (*FilePaths) OpenJSON Uses

func (pf *FilePaths) OpenJSON(filename string) error

Open file paths from a JSON-formatted file.

func (*FilePaths) SaveJSON Uses

func (pf *FilePaths) SaveJSON(filename string) error

Save file paths to a JSON-formatted file.

type FillRule Uses

type FillRule int
const (
    FillRuleNonZero FillRule = iota
    FillRuleEvenOdd
    FillRuleN
)

func (*FillRule) FromString Uses

func (i *FillRule) FromString(s string) error

func (FillRule) MarshalJSON Uses

func (ev FillRule) MarshalJSON() ([]byte, error)

func (FillRule) String Uses

func (i FillRule) String() string

func (*FillRule) UnmarshalJSON Uses

func (ev *FillRule) UnmarshalJSON(b []byte) error

type FillStyle Uses

type FillStyle struct {
    On      bool      `desc:"is fill active -- if property is none then false"`
    Color   ColorSpec `xml:"fill" desc:"fill color specification"`
    Opacity float32   `xml:"fill-opacity" desc:"global alpha opacity / transparency factor"`
    Rule    FillRule  `xml:"fill-rule" desc:"rule for how to fill more complex shapes with crossing lines"`
}

FillStyle contains all the properties for filling a region

func (*FillStyle) Defaults Uses

func (pf *FillStyle) Defaults()

Defaults initializes default values for paint fill

func (*FillStyle) SetColor Uses

func (pf *FillStyle) SetColor(cl color.Color)

SetColor sets a solid fill color -- nil turns off filling

func (*FillStyle) SetColorSpec Uses

func (pf *FillStyle) SetColorSpec(cl *ColorSpec)

SetColorSpec sets full color spec from source

func (*FillStyle) SetStylePost Uses

func (pf *FillStyle) SetStylePost(props ki.Props)

SetStylePost does some updating after setting the style from user properties

type FocusChanges Uses

type FocusChanges int32

FocusChanges are the kinds of changes that can be reported via FocusChanged2D method

const (
    // FocusLost means that keyboard focus is on a different widget
    // (typically) and this one lost focus
    FocusLost FocusChanges = iota

    // FocusGot means that this widget just got keyboard focus
    FocusGot

    // FocusInactive means that although this widget retains keyboard focus
    // (nobody else has it), the user has clicked on something else and
    // therefore the focus should be considered inactive (distracted), and any
    // changes should be applied as this other action could result in closing
    // of a dialog etc.  Keyboard events will still be sent to the focus
    // widget, but it is up to the widget if or how to process them (e.g., it
    // could reactivate on its own).
    FocusInactive

    // FocusActive means that the user has moved the mouse back into the
    // focused widget to resume active keyboard focus.
    FocusActive

    FocusChangesN
)

func (*FocusChanges) FromString Uses

func (i *FocusChanges) FromString(s string) error

func (FocusChanges) String Uses

func (i FocusChanges) String() string

type FontInfo Uses

type FontInfo struct {
    Name    string      `desc:"official regularized name of font"`
    Stretch FontStretch `xml:"stretch" desc:"stretch: normal, expanded, condensed, etc"`
    Weight  FontWeights `xml:"weight" desc:"weight: normal, bold, etc"`
    Style   FontStyles  `xml:"style" desc:"style -- normal, italic, etc"`
    Example string      `desc:"example text -- styled according to font params in chooser"`
}

FontInfo contains basic font information for choosing a given font -- displayed in the font chooser dialog.

type FontLib Uses

type FontLib struct {
    FontPaths  []string                     `desc:"list of font paths to search for fonts"`
    FontsAvail map[string]string            `desc:"map of font name to path to file"`
    FontInfo   []FontInfo                   `desc:"information about each font -- this list should be used for selecting valid regularized font names"`
    Faces      map[string]map[int]font.Face `desc:"double-map of cached fonts, by font name and then integer font size within that"`
}

FontLib holds the fonts available in a font library. The font name is regularized so that the base "Regular" font is the root term of a sequence of other font names that describe the stretch, weight, and style, e.g., "Arial" as the base name, "Arial Bold", "Arial Bold Italic" etc. Thus, each font name specifies a particular font weight and style. When fonts are loaded into the library, the names are appropriately regularized.

var FontLibrary FontLib

FontLibrary is the gi font library, initialized from fonts available on font paths

func (*FontLib) AddFontPaths Uses

func (fl *FontLib) AddFontPaths(paths ...string) bool

func (*FontLib) DeleteFont Uses

func (fl *FontLib) DeleteFont(fontnm string)

func (*FontLib) Font Uses

func (fl *FontLib) Font(fontnm string, size int) (font.Face, error)

Font gets a particular font, specified by the official regularized font name (see FontsAvail list), at given dots size (integer), using a cache of loaded fonts.

func (*FontLib) FontAvail Uses

func (fl *FontLib) FontAvail(fontnm string) bool

FontAvail determines if a given font name is available (case insensitive)

func (*FontLib) FontsAvailFromPath Uses

func (fl *FontLib) FontsAvailFromPath(path string) error

FontsAvailFromPath scans for all fonts we can use on a given path, gathering info into FontsAvail and FontInfo.

func (*FontLib) GoFontsAvail Uses

func (fl *FontLib) GoFontsAvail()

func (*FontLib) Init Uses

func (fl *FontLib) Init()

func (*FontLib) InitFontPaths Uses

func (fl *FontLib) InitFontPaths(paths ...string)

InitFontPaths initializes font paths to system defaults, only if no paths have yet been set

func (*FontLib) OpenAllFonts Uses

func (fl *FontLib) OpenAllFonts(size int)

OpenAllFonts attempts to load all fonts that were found -- call this before displaying the font chooser to eliminate any bad fonts.

func (*FontLib) UpdateFontsAvail Uses

func (fl *FontLib) UpdateFontsAvail() bool

UpdateFontsAvail scans for all fonts we can use on the FontPaths

type FontName Uses

type FontName string

FontName is used to specify an font -- just the unique name of the font family -- automtically provides a chooser menu for fonts using ValueView system

type FontStretch Uses

type FontStretch int32

FontStretch are different stretch levels of font. These are less typically available on most platforms by default.

const (
    FontStrNormal FontStretch = iota
    FontStrUltraCondensed
    FontStrExtraCondensed
    FontStrSemiCondensed
    FontStrSemiExpanded
    FontStrExtraExpanded
    FontStrUltraExpanded
    FontStrCondensed
    FontStrExpanded
    FontStrNarrower
    FontStrWider
    FontStretchN
)

func (*FontStretch) FromString Uses

func (i *FontStretch) FromString(s string) error

func (FontStretch) MarshalJSON Uses

func (ev FontStretch) MarshalJSON() ([]byte, error)

func (FontStretch) String Uses

func (i FontStretch) String() string

func (*FontStretch) UnmarshalJSON Uses

func (ev *FontStretch) UnmarshalJSON(b []byte) error

type FontStyle Uses

type FontStyle struct {
    Color    Color           `xml:"color" inherit:"true" desc:"text color -- also defines the currentColor variable value"`
    BgColor  ColorSpec       `xml:"background-color" desc:"background color -- not inherited, transparent by default"`
    Opacity  float32         `xml:"opacity" desc:"alpha value to apply to all elements"`
    Size     units.Value     `xml:"font-size" desc:"size of font to render -- convert to points when getting font to use"`
    Family   string          `xml:"font-family" inherit:"true" desc:"font family -- ordered list of comma-separated names from more general to more specific to use -- use split on , to parse"`
    Style    FontStyles      `xml:"font-style" inherit:"true" desc:"style -- normal, italic, etc"`
    Weight   FontWeights     `xml:"font-weight" inherit:"true" desc:"weight: normal, bold, etc"`
    Stretch  FontStretch     `xml:"font-stretch" inherit:"true" desc:"font stretch / condense options"`
    Variant  FontVariants    `xml:"font-variant" inherit:"true" desc:"normal or small caps"`
    Deco     TextDecorations `xml:"text-decoration" desc:"underline, line-through, etc -- not inherited"`
    Shift    BaselineShifts  `xml:"baseline-shift" desc:"super / sub script -- not inherited"`
    Face     font.Face       `view:"-" desc:"actual font codes for drawing text -- just a pointer into FontLibrary of loaded fonts"`
    Height   float32         `desc:"reference 1.0 spacing line height of font in dots -- computed from font as ascent + descent + lineGap, where lineGap is specified by the font as the recommended line spacing"`
    Em       float32         `desc:"Em size of font -- this is NOT actually the width of the letter M, but rather the specified point size of the font (in actual display dots, not points) -- it does NOT include the descender and will not fit the entire height of the font"`
    Ex       float32         `desc:"Ex size of font -- this is the actual height of the letter x in the font"`
    Ch       float32         `desc:"Ch size of font -- this is the actual width of the 0 glyph in the font"`
    Rem      float32         `desc:"Rem size of font -- 12pt converted to same effective DPI as above measurements"`
    FaceName string          `desc:"full name of font face as loaded -- computed based on Family, Style, Weight, etc"`
}

FontStyle contains all font styling information, including everything that is used in SVG text rendering -- used in Paint and in Style. Most of font information is inherited.

var FontStyleDefault FontStyle

FontStyleDefault is default style can be used when property specifies "default"

func (*FontStyle) ClearDeco Uses

func (fs *FontStyle) ClearDeco(deco TextDecorations)

ClearDeco clears decoration (underline, etc), which uses bitflag to allow multiple combinations

func (*FontStyle) ComputeMetrics Uses

func (fs *FontStyle) ComputeMetrics(ctxt *units.Context)

ComputeMetrics computes the Height, Em, Ex, Ch and Rem metrics associated with current font and overall units context

func (*FontStyle) Defaults Uses

func (fs *FontStyle) Defaults()

func (*FontStyle) FaceNm Uses

func (fs *FontStyle) FaceNm() string

FaceNm returns the full FaceName to use for the current FontStyle spec, robustly

func (*FontStyle) InheritFields Uses

func (fs *FontStyle) InheritFields(par *FontStyle)

InheritFields from parent: Manual inheriting of values is much faster than automatic version!

func (*FontStyle) OpenFont Uses

func (fs *FontStyle) OpenFont(ctxt *units.Context)

OpenFont loads the font specified by the font style from the font library. This is the primary method to use for loading fonts, as it uses a robust fallback method to finding an appropriate font, and falls back on the builtin Go font as a last resort. The Face field will have the resulting font. The font size is always rounded to nearest integer, to produce better-looking results (presumably). The current metrics and given unit.Context are updated based on the properties of the font.

func (*FontStyle) SetDeco Uses

func (fs *FontStyle) SetDeco(deco TextDecorations)

SetDeco sets decoration (underline, etc), which uses bitflag to allow multiple combinations

func (*FontStyle) SetStylePost Uses

func (fs *FontStyle) SetStylePost(props ki.Props)

SetStylePost does any updates after generic xml-tag property setting -- use for anything that also has non-standard values that might not be processed properly by default

func (*FontStyle) SetStyleProps Uses

func (fs *FontStyle) SetStyleProps(parent *FontStyle, props ki.Props)

SetStyleProps sets font style values based on given property map (name: value pairs), inheriting elements as appropriate from parent, and also having a default style for the "initial" setting

func (*FontStyle) SetUnitContext Uses

func (fs *FontStyle) SetUnitContext(ctxt *units.Context)

SetUnitContext sets the font-specific information in the given units.Context, based on the currently-loaded face.

func (*FontStyle) StyleCSS Uses

func (fs *FontStyle) StyleCSS(tag string, cssAgg ki.Props, ctxt *units.Context) bool

Style CSS looks for "tag" name props in cssAgg props, and applies those to style if found, and returns true -- false if no such tag found

func (*FontStyle) ToDots Uses

func (fs *FontStyle) ToDots(ctxt *units.Context)

ToDots calls ToDots on all units.Value fields in the style (recursively)

type FontStyles Uses

type FontStyles int32

FontStyles styles of font: normal, italic, etc

const (
    FontNormal FontStyles = iota
    FontItalic
    FontOblique
    FontStylesN
)

func (*FontStyles) FromString Uses

func (i *FontStyles) FromString(s string) error

func (FontStyles) MarshalJSON Uses

func (ev FontStyles) MarshalJSON() ([]byte, error)

func (FontStyles) String Uses

func (i FontStyles) String() string

func (*FontStyles) UnmarshalJSON Uses

func (ev *FontStyles) UnmarshalJSON(b []byte) error

type FontVariants Uses

type FontVariants int32

FontVariants is just normal vs. small caps. todo: not currently supported

const (
    FontVarNormal FontVariants = iota
    FontVarSmallCaps
    FontVariantsN
)

func (*FontVariants) FromString Uses

func (i *FontVariants) FromString(s string) error

func (FontVariants) MarshalJSON Uses

func (ev FontVariants) MarshalJSON() ([]byte, error)

func (FontVariants) String Uses

func (i FontVariants) String() string

func (*FontVariants) UnmarshalJSON Uses

func (ev *FontVariants) UnmarshalJSON(b []byte) error

type FontWeights Uses

type FontWeights int32

FontWeights are the valid names for different weights of font, with both the numeric and standard names given. The regularized font names in the font library use the names, as those are typically found in the font files.

const (
    WeightNormal FontWeights = iota
    Weight100
    WeightThin // (Hairline)
    Weight200
    WeightExtraLight // (UltraLight)
    Weight300
    WeightLight
    Weight400
    Weight500
    WeightMedium
    Weight600
    WeightSemiBold // (DemiBold)
    Weight700
    WeightBold
    Weight800
    WeightExtraBold // (UltraBold)
    Weight900
    WeightBlack
    WeightBolder
    WeightLighter
    FontWeightsN
)

func (*FontWeights) FromString Uses

func (i *FontWeights) FromString(s string) error

func (FontWeights) MarshalJSON Uses

func (ev FontWeights) MarshalJSON() ([]byte, error)

func (FontWeights) String Uses

func (i FontWeights) String() string

func (*FontWeights) UnmarshalJSON Uses

func (ev *FontWeights) UnmarshalJSON(b []byte) error

type Frame Uses

type Frame struct {
    Layout
    Stripes Stripes `desc:"options for striped backgrounds -- rendered as darker bands relative to background color"`
}

Frame is a Layout that renders a background according to the background-color style setting, and optional striping for grid layouts

func (*Frame) FrameStdRender Uses

func (fr *Frame) FrameStdRender()

FrameStdRender does the standard rendering of the frame itself

func (*Frame) Render2D Uses

func (fr *Frame) Render2D()

func (*Frame) RenderStripes Uses

func (fr *Frame) RenderStripes()

type Geom2DInt Uses

type Geom2DInt struct {
    Pos  image.Point
    Size image.Point
}

Geom2DInt defines a geometry in 2D dots units (int) -- this is just a more convenient format than image.Rectangle for cases where the size and position are independently updated (e.g., Viewport)

func (*Geom2DInt) Bounds Uses

func (gm *Geom2DInt) Bounds() image.Rectangle

Bounds converts geom to equivalent image.Rectangle

func (*Geom2DInt) SetRect Uses

func (gm *Geom2DInt) SetRect(r image.Rectangle)

SetRect sets values from image.Rectangle

func (*Geom2DInt) SizeRect Uses

func (gm *Geom2DInt) SizeRect() image.Rectangle

SizeRect converts geom to rect version of size at 0 pos

type Gradient Uses

type Gradient struct {
    Node2DBase
    Grad ColorSpec `desc:"the color gradient"`
}

Gradient is used for holding a specified color gradient -- name is id for lookup in url

type GradientPoints Uses

type GradientPoints int32

GradientPoints defines points within the gradient

const (
    GpX1 GradientPoints = iota
    GpY1
    GpX2
    GpY2
    GradientPointsN
)

type GridData Uses

type GridData struct {
    SizeNeed    float32
    SizePref    float32
    SizeMax     float32
    AllocSize   float32
    AllocPosRel float32
}

GridData contains data for grid layout -- only one value needed for relevant dim

type HSLA Uses

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

func (HSLA) RGBA Uses

func (c HSLA) RGBA() (r, g, b, a uint32)

Implements the color.Color interface

type Icon Uses

type Icon struct {
    WidgetBase
    Filename string `desc:"file name for the loaded icon, if loaded"`
}

Icon is a wrapper around a child svg.Icon SVG element. SVG should contain no color information -- it should just be a filled shape where the fill and stroke colors come from the surrounding context / paint settings. The rendered version is cached for a given size. Icons are always copied from an original source icon and then can be customized from there.

func (*Icon) Layout2D Uses

func (ic *Icon) Layout2D(parBBox image.Rectangle, iter int) bool

func (*Icon) Render2D Uses

func (ic *Icon) Render2D()

func (*Icon) SVGIcon Uses

func (ic *Icon) SVGIcon() *Viewport2D

SVGIcon returns the child svg icon, or nil

func (*Icon) SetIcon Uses

func (ic *Icon) SetIcon(name string) (bool, error)

SetIcon sets the icon by name into given Icon wrapper, returning error message if not found etc, and returning true if a new icon was actually set -- does nothing if UniqueNm is already == icon name and has children, and deletes children if name is nil / none (both cases return false for new icon)

func (*Icon) Size2D Uses

func (ic *Icon) Size2D(iter int)

func (*Icon) Style2D Uses

func (ic *Icon) Style2D()

type IconMgr Uses

type IconMgr interface {
    // IsValid checks if given icon name is a valid name for an available icon
    // (also checks that the icon manager is non-nil and issues appropriate error)
    IsValid(iconName string) bool

    // SetIcon sets the icon by name into given Icon wrapper, returning error
    // message if not found etc
    SetIcon(ic *Icon, iconName string) error

    // IconList returns the list of available icon names, optionally sorted
    // alphabetically (otherwise in map-random order)
    IconList(alphaSort bool) []IconName
}

IconMgr is the manager of all things Icon -- needed to allow svg to be a separate package, and implemented by svg.IconMgr

var TheIconMgr IconMgr

TheIconMgr is set by loading the gi/svg package -- all final users must import github/goki/gi/svg to get its init function

type IconName Uses

type IconName string

IconName is used to specify an icon -- currently just the unique name of the icon -- automtically provides a chooser menu for icons using ValueView system

func (IconName) IsNil Uses

func (inm IconName) IsNil() bool

IsNil tests whether the icon name is empty, 'none' or 'nil' -- indicates to not use a icon

func (IconName) IsValid Uses

func (inm IconName) IsValid() bool

IsValid tests whether the icon name is valid -- represents a non-nil icon available in the current or default icon set

func (IconName) SetIcon Uses

func (inm IconName) SetIcon(ic *Icon) (bool, error)

SetIcon sets the icon by name into given Icon wrapper, returning error message if not found etc, and returning true if a new icon was actually set -- does nothing if UniqueNm is already == icon name and has children, and deletes children if name is nil / none (both cases return false for new icon)

type KeyFuns Uses

type KeyFuns int32

KeyFuns are functions that keyboard events can perform in the GUI -- seems possible to keep this flat and consistent across different contexts, as long as the functions can be appropriately reinterpreted for each context.

const (
    KeyFunNil KeyFuns = iota
    KeyFunMoveUp
    KeyFunMoveDown
    KeyFunMoveRight
    KeyFunMoveLeft
    KeyFunPageUp
    KeyFunPageDown
    KeyFunPageRight
    KeyFunPageLeft
    KeyFunHome    // start-of-line
    KeyFunEnd     // end-of-line
    KeyFunDocHome // start-of-doc -- Control / Alt / Shift +Home
    KeyFunDocEnd  // end-of-doc Control / Alt / Shift +End
    KeyFunWordRight
    KeyFunWordLeft
    KeyFunFocusNext  // tab
    KeyFunFocusPrev  // shift-tab
    KeyFunSelectItem // enter
    KeyFunCancelSelect
    KeyFunSelectMode
    KeyFunSelectAll
    KeyFunAccept // accept any changes and close dialog / move to next
    KeyFunAbort
    KeyFunEditItem
    KeyFunCopy
    KeyFunCut
    KeyFunPaste
    KeyFunBackspace
    KeyFunBackspaceWord
    KeyFunDelete
    KeyFunDeleteWord
    KeyFunKill
    KeyFunDuplicate
    KeyFunUndo
    KeyFunRedo
    KeyFunInsert
    KeyFunInsertAfter
    KeyFunGoGiEditor
    KeyFunZoomOut
    KeyFunZoomIn
    KeyFunPrefs
    KeyFunRefresh
    KeyFunRecenter // Ctrl+L in emacs
    KeyFunComplete
    KeyFunSearch // Ctrl+S in emacs -- more interactive type of search
    KeyFunFind   // Command+F full-dialog find
    KeyFunJump
    KeyFunsN
)

func KeyFun Uses

func KeyFun(chord key.Chord) KeyFuns

KeyFun translates chord into keyboard function -- use oswin key.Chord to get chord

func (*KeyFuns) FromString Uses

func (i *KeyFuns) FromString(s string) error

func (KeyFuns) MarshalJSON Uses

func (kf KeyFuns) MarshalJSON() ([]byte, error)

func (KeyFuns) String Uses

func (i KeyFuns) String() string

func (*KeyFuns) UnmarshalJSON Uses

func (kf *KeyFuns) UnmarshalJSON(b []byte) error

type KeyMap Uses

type KeyMap map[key.Chord]KeyFuns

KeyMap is a map between a key sequence (chord) and a specific KeyFun function. This mapping must be unique, in that each chord has unique KeyFun, but multiple chords can trigger the same function.

var ActiveKeyMap *KeyMap

ActiveKeyMap points to the active map -- users can set this to an alternative map in Prefs

func (*KeyMap) ChordForFun Uses

func (km *KeyMap) ChordForFun(kf KeyFuns) key.Chord

ChordForFun returns first key chord trigger for given KeyFun in map

func (*KeyMap) ToSlice Uses

func (km *KeyMap) ToSlice() []KeyMapItem

ToSlice copies this keymap to a slice of KeyMapItem's

func (*KeyMap) Update Uses

func (km *KeyMap) Update()

Update ensures that the given keymap has at least one entry for every defined KeyFun, grabbing ones from the default map if not, and also eliminates any Nil entries which might reflect out-of-date functions

type KeyMapItem Uses

type KeyMapItem struct {
    Key key.Chord `desc:"the key chord that activates a function"`
    Fun KeyFuns   `desc:"the function of that key"`
}

KeyMapItem records one element of the key map -- used for organizing the map.

type KeyMapName Uses

type KeyMapName string

KeyMapName has an associated ValueView for selecting from the list of available key map names, for use in preferences etc.

type KeyMaps Uses

type KeyMaps []KeyMapsItem

KeyMaps is a list of KeyMap's -- users can edit these in Prefs -- to create a custom one, just duplicate an existing map, rename, and customize

var AvailKeyMaps KeyMaps

AvailKeyMaps is the current list of available keymaps for use -- can be loaded / saved / edited with preferences. This is set to StdKeyMaps at startup.

func (*KeyMaps) CopyFrom Uses

func (km *KeyMaps) CopyFrom(cp KeyMaps)

CopyFrom copies keymaps from given other map

func (*KeyMaps) MapByName Uses

func (km *KeyMaps) MapByName(name KeyMapName) (*KeyMap, int, bool)

MapByName returns a keymap and index by name -- returns false and emits a message to stdout if not found

func (*KeyMaps) OpenJSON Uses

func (km *KeyMaps) OpenJSON(filename FileName) error

OpenJSON opens keymaps from a JSON-formatted file.

func (*KeyMaps) OpenPrefs Uses

func (km *KeyMaps) OpenPrefs() error

OpenPrefs opens KeyMaps from GoGi standard prefs directory, using PrefsKeyMapsFileName

func (*KeyMaps) RevertToStd Uses

func (km *KeyMaps) RevertToStd()

RevertToStd reverts this map to using the StdKeyMaps that are compiled into the program and have all the lastest key functions bound to standard values.

func (*KeyMaps) SaveJSON Uses

func (km *KeyMaps) SaveJSON(filename FileName) error

SaveJSON saves keymaps to a JSON-formatted file.

func (*KeyMaps) SavePrefs Uses

func (km *KeyMaps) SavePrefs() error

SavePrefs saves KeyMaps to GoGi standard prefs directory, using PrefsKeyMapsFileName

func (*KeyMaps) ViewStd Uses

func (km *KeyMaps) ViewStd()

ViewStd shows the standard maps that are compiled into the program and have all the lastest key functions bound to standard values. Useful for comparing against custom maps.

type KeyMapsItem Uses

type KeyMapsItem struct {
    Name string `width:"20" desc:"name of keymap"`
    Desc string `desc:"description of keymap -- good idea to include source it was derived from"`
    Map  KeyMap `desc:"to edit key sequence click button and type new key combination; to edit function mapped to key sequence choose from menu"`
}

KeyMapsItem is an entry in a KeyMaps list

type Label Uses

type Label struct {
    WidgetBase
    Text        string              `xml:"text" desc:"label to display"`
    Selectable  bool                `desc:"is this label selectable? if so, it will change background color in response to selection events and update selection state on mouse clicks"`
    Redrawable  bool                `desc:"is this label going to be redrawn frequently without an overall full re-render?  if so, you need to set this flag to avoid weird overlapping rendering results from antialiasing"`
    LinkSig     ki.Signal           `json:"-" xml:"-" view:"-" desc:"signal for clicking on a link -- data is a string of the URL -- if nobody receiving this signal, calls TextLinkHandler then URLHandler"`
    StateStyles [LabelStatesN]Style `json:"-" xml:"-" desc:"styles for different states of label"`
    Render      TextRender          `xml:"-" json:"-" desc:"render data for text label"`
    RenderPos   Vec2D               `xml:"-" json:"-" desc:"position offset of start of text rendering, from last render -- AllocPos plus alignment factors for center, right etc."`
    CurBgColor  Color               `xml:"-" json:"-" desc:"current background color -- grabbed when rendering for first time, and used when toggling off of selected mode, or for redrawable, to wipe out bg"`
}

Label is a widget for rendering text labels -- supports full widget model including box rendering, and full HTML styling, including links -- LinkSig emits link with data of URL -- opens default browser if nobody receiving signal. The default white-space option is 'pre' -- set to 'normal' or other options to get word-wrapping etc.

func (*Label) ConnectEvents2D Uses

func (lb *Label) ConnectEvents2D()

func (*Label) GrabCurBgColor Uses

func (lb *Label) GrabCurBgColor()

func (*Label) HoverEvent Uses

func (lb *Label) HoverEvent()

func (*Label) Label Uses

func (lb *Label) Label() string

Label returns the display label for this node, satisfying the Labeler interface

func (*Label) LabelEvents Uses

func (lb *Label) LabelEvents()

func (*Label) Layout2D Uses

func (lb *Label) Layout2D(parBBox image.Rectangle, iter int) bool

func (*Label) LayoutLabel Uses

func (lb *Label) LayoutLabel()

func (*Label) MouseEvent Uses

func (lb *Label) MouseEvent()

func (*Label) MouseMoveEvent Uses

func (lb *Label) MouseMoveEvent()
func (lb *Label) OpenLink(tl *TextLink)

OpenLink opens given link, either by sending LinkSig signal if there are receivers, or by calling the TextLinkHandler if non-nil, or URLHandler if non-nil (which by default opens user's default browser via oswin/App.OpenURL())

func (*Label) Render2D Uses

func (lb *Label) Render2D()

func (*Label) SetStateStyle Uses

func (lb *Label) SetStateStyle()

SetStateStyle sets the style based on the inactive, selected flags

func (*Label) SetText Uses

func (lb *Label) SetText(txt string)

SetText sets the text and updates the rendered version

func (*Label) SetTextAction Uses

func (lb *Label) SetTextAction(txt string)

SetTextAction sets the text and triggers an update action

func (*Label) Size2D Uses

func (lb *Label) Size2D(iter int)

func (*Label) Style2D Uses

func (lb *Label) Style2D()

func (*Label) StyleLabel Uses

func (lb *Label) StyleLabel()

func (*Label) TextPos Uses

func (lb *Label) TextPos() Vec2D

type LabelStates Uses

type LabelStates int32

LabelStates are mutually-exclusive label states -- determines appearance

const (
    // normal active state
    LabelActive LabelStates = iota

    // inactive -- font is dimmed
    LabelInactive

    // selected -- background is selected color
    LabelSelected

    // total number of button states
    LabelStatesN
)

func (*LabelStates) FromString Uses

func (i *LabelStates) FromString(s string) error

func (LabelStates) MarshalJSON Uses

func (ev LabelStates) MarshalJSON() ([]byte, error)

func (LabelStates) String Uses

func (i LabelStates) String() string

func (*LabelStates) UnmarshalJSON Uses

func (ev *LabelStates) UnmarshalJSON(b []byte) error

type Labeler Uses

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 Uses

type Layout struct {
    WidgetBase
    Lay           Layouts             `xml:"lay" desc:"type of layout to use"`
    Spacing       units.Value         `xml:"spacing" desc:"extra space to add between elements in the layout"`
    StackTop      int                 `desc:"for Stacked layout, index of node to use as the top of the stack -- only node at this index is rendered -- if not a valid index, nothing is rendered"`
    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][]GridData `json:"-" xml:"-" desc:"grid data for rows in [0] and cols in [1]"`
    NeedsRedo     bool                `json:"-" xml:"-" desc:"true if this layout got a redo = true on previous iteration -- otherwise it just skips any re-layout on subsequent iteration"`
    FocusName     string              `json:"-" xml:"-" desc:"accumulated name to search for when keys are typed"`
    FocusNameTime time.Time           `json:"-" xml:"-" desc:"time of last focus name event -- for timeout"`
    FocusNameLast ki.Ki               `json:"-" xml:"-" desc:"last element focused on -- used as a starting point if name is the same"`
}

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 LayoutHoriz layout, to determine left, right, center, justified). Layouts can automatically add scrollbars depending on the Overflow layout style.

var LayoutDefault Layout

LayoutDefault is default obj that can be used when property specifies "default"

func (*Layout) AllocFromParent Uses

func (ly *Layout) AllocFromParent()

AllocFromParent: if we are not a child of a layout, then get allocation from a parent obj that has a layout size

func (*Layout) AsLayout2D Uses

func (ly *Layout) AsLayout2D() *Layout

func (*Layout) AutoScroll Uses

func (ly *Layout) AutoScroll(pos image.Point) bool

AutoScroll scrolls the layout based on mouse position, when appropriate (DND, menus)

func (*Layout) AutoScrollDim Uses

func (ly *Layout) AutoScrollDim(dim Dims2D, st, pos int) bool

AutoScrollDim auto-scrolls along one dimension

func (*Layout) AvailSize Uses

func (ly *Layout) AvailSize() Vec2D

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) BBox2D Uses

func (ly *Layout) BBox2D() image.Rectangle

func (*Layout) ChildByLabelStartsCanFocus Uses

func (ly *Layout) ChildByLabelStartsCanFocus(name string, after ki.Ki) (ki.Ki, bool)

ChildByLabelStartsCanFocus uses breadth-first search to find first element within layout whose Label (from Labeler interface) starts with given string (case insensitive) and can focus. If after is non-nil, only finds after given element.

func (*Layout) ChildWithFocus Uses

func (ly *Layout) ChildWithFocus() (ki.Ki, int)

ChildWithFocus returns a direct child of this layout that either is the current window focus item, or contains that focus item (along with its index) -- nil, -1 if none.

func (*Layout) ChildrenBBox2D Uses

func (ly *Layout) ChildrenBBox2D() image.Rectangle

func (*Layout) ComputeBBox2D Uses

func (ly *Layout) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)

func (*Layout) ConnectEvents2D Uses

func (ly *Layout) ConnectEvents2D()

func (*Layout) DeactivateScroll Uses

func (ly *Layout) DeactivateScroll(sc *ScrollBar)

DeactivateScroll turns off given scrollbar, without deleting, so it can be easily re-used

func (*Layout) DeleteScroll Uses

func (ly *Layout) DeleteScroll(d Dims2D)

DeleteScroll deletes scrollbar along given dimesion. todo: we are leaking the scrollbars -- move into a container Field

func (*Layout) FinalizeLayout Uses

func (ly *Layout) FinalizeLayout()

FinalizeLayout is final pass through children to finalize the layout, computing summary size stats

func (*Layout) FocusNextChild Uses

func (ly *Layout) FocusNextChild(updn bool) bool

FocusNextChild attempts to move the focus into the next layout child (with wraparound to start) -- returns true if successful

func (*Layout) FocusOnName Uses

func (ly *Layout) FocusOnName(kt *key.ChordEvent) bool

FocusOnName processes key events to look for an element starting with given name

func (*Layout) FocusPrevChild Uses

func (ly *Layout) FocusPrevChild(updn bool) bool

FocusPrevChild attempts to move the focus into the previous layout child (with wraparound to end) -- returns true if successful

func (*Layout) GatherSizes Uses

func (ly *Layout) GatherSizes()

GatherSizes is size first pass: gather the size information from the children

func (*Layout) GatherSizesGrid Uses

func (ly *Layout) GatherSizesGrid()

GatherSizesGrid is size first pass: gather the size information from the children, grid version

func (*Layout) HasAnyScroll Uses

func (ly *Layout) HasAnyScroll() bool

HasAnyScroll returns true if layout has

func (*Layout) HasFocus2D Uses

func (ly *Layout) HasFocus2D() bool

func (*Layout) Init2D Uses

func (ly *Layout) Init2D()

func (*Layout) KeyChordEvent Uses

func (ly *Layout) KeyChordEvent()

KeyChordEvent processes (lowpri) layout key events

func (*Layout) Layout2D Uses

func (ly *Layout) Layout2D(parBBox image.Rectangle, iter int) bool

func (*Layout) LayoutAlongDim Uses

func (ly *Layout) LayoutAlongDim(dim Dims2D)

LayoutAlongDim lays out all children along given dim -- only affects that dim -- e.g., use LayoutSharedDim for other dim.

func (*Layout) LayoutGrid Uses

func (ly *Layout) LayoutGrid()

LayoutGrid manages overall grid layout of children

func (*Layout) LayoutGridDim Uses

func (ly *Layout) LayoutGridDim(rowcol RowCol, dim Dims2D)

LayoutGridDim lays out grid data along each dimension (row, Y; col, X), same as LayoutAlongDim. For cols, X has width prefs of each -- turn that into an actual allocated width for each column, and likewise for rows.

func (*Layout) LayoutKeys Uses

func (ly *Layout) LayoutKeys(kt *key.ChordEvent)

LayoutKeys is key processing for layouts -- focus name and arrow keys

func (*Layout) LayoutScrollEvents Uses

func (ly *Layout) LayoutScrollEvents()

LayoutScrollEvents registers scrolling-related mouse events processed by Layout -- most subclasses of Layout will want these..

func (*Layout) LayoutScrolls Uses

func (ly *Layout) LayoutScrolls()

LayoutScrolls arranges scrollbars

func (*Layout) LayoutSharedDim Uses

func (ly *Layout) LayoutSharedDim(dim Dims2D)

LayoutSharedDim lays out items along a shared dimension, where all elements share the same space, e.g., Horiz for a Vert layout, and vice-versa.

func (*Layout) LayoutSharedDimImpl Uses

func (ly *Layout) LayoutSharedDimImpl(avail, need, pref, max, spc float32, al Align) (pos, size float32)

LayoutSharedDim implements calculations to layout for the shared dimension (i.e., Vertical for Horizontal layout). Returns pos and size.

func (*Layout) ManageOverflow Uses

func (ly *Layout) ManageOverflow()

ManageOverflow processes any overflow according to overflow settings.

func (*Layout) Move2D Uses

func (ly *Layout) Move2D(delta image.Point, parBBox image.Rectangle)

func (*Layout) Move2DChildren Uses

func (ly *Layout) Move2DChildren(delta image.Point)

func (*Layout) Move2DDelta Uses

func (ly *Layout) Move2DDelta(delta image.Point) image.Point

we add our own offset here

func (*Layout) Move2DScrolls Uses

func (ly *Layout) Move2DScrolls(delta image.Point, parBBox image.Rectangle)

Move2DScrolls moves scrollbars based on scrolling taking place in parent layouts -- critical to call this BEFORE we add our own delta, which is generated from these very same scrollbars.

func (*Layout) Render2D Uses

func (ly *Layout) Render2D()

func (*Layout) Render2DChildren Uses

func (ly *Layout) Render2DChildren()

render the children

func (*Layout) RenderScrolls Uses

func (ly *Layout) RenderScrolls()

RenderScrolls draws the scrollbars

func (*Layout) ScrollDelta Uses

func (ly *Layout) ScrollDelta(me *mouse.ScrollEvent)

ScrollDelta processes a scroll event. If only one dimension is processed, and there is a non-zero in other, then the consumed dimension is reset to 0 and the event is left unprocessed, so a higher level can consume the remainder.

func (*Layout) ScrollDimToCenter Uses

func (ly *Layout) ScrollDimToCenter(dim Dims2D, pos int) bool

ScrollDimToCenter scrolls to put the given child coordinate position (eg., middle of a view box) at the center of our scroll area, to the extent possible -- returns true if scrolling was needed.

func (*Layout) ScrollDimToEnd Uses

func (ly *Layout) ScrollDimToEnd(dim Dims2D, pos int) bool

ScrollDimToEnd scrolls to put the given child coordinate position (eg., bottom / right of a view box) at the end (bottom / right) of our scroll area, to the extent possible -- returns true if scrolling was needed.

func (*Layout) ScrollDimToStart Uses

func (ly *Layout) ScrollDimToStart(dim Dims2D, pos int) bool

ScrollDimToStart scrolls to put the given child coordinate position (eg., top / left of a view box) at the start (top / left) of our scroll area, to the extent possible -- returns true if scrolling was needed.

func (*Layout) ScrollToBox Uses

func (ly *Layout) ScrollToBox(box image.Rectangle) bool

ScrollToBox scrolls the layout to ensure that given rect box is in view -- returns true if scrolling was needed

func (*Layout) ScrollToBoxDim Uses

func (ly *Layout) ScrollToBoxDim(dim Dims2D, minBox, maxBox int) bool

ScrollToBoxDim scrolls to ensure that given rect box along one dimension is in view -- returns true if scrolling was needed

func (*Layout) ScrollToItem Uses

func (ly *Layout) ScrollToItem(ni Node2D) bool

ScrollToItem scrolls the layout to ensure that given item is in view -- returns true if scrolling was needed

func (*Layout) SetScroll Uses

func (ly *Layout) SetScroll(d Dims2D)

SetScroll sets a scrollbar along given dimension

func (*Layout) Size2D Uses

func (ly *Layout) Size2D(iter int)

func (*Layout) Style2D Uses

func (ly *Layout) Style2D()

func (*Layout) StyleLayout Uses

func (ly *Layout) StyleLayout()

func (*Layout) SumDim Uses

func (ly *Layout) SumDim(d Dims2D) bool

SumDim returns whether we sum up elements along given dimension? else use max for shared dimension.

func (*Layout) SummedDim Uses

func (ly *Layout) SummedDim() Dims2D

SummedDim returns the dimension along which layout is summing.

type LayoutData Uses

type LayoutData struct {
    Size          SizePrefs `desc:"size constraints for this item -- from layout style"`
    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"`
    AllocSizeOrig Vec2D     `desc:"original copy of allocated size of this item, by the parent layout -- some widgets will resize themselves within a given layout (e.g., a TextView), but still need access to their original allocated size"`
    AllocPosOrig  Vec2D     `desc:"original copy of allocated relative position of this item, by the parent layout -- need for scrolling which can update AllocPos"`
}

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 Uses

func (ld *LayoutData) Defaults()

func (*LayoutData) Reset Uses

func (ld *LayoutData) Reset()

Reset is called at start of layout process -- resets all values back to 0

func (*LayoutData) SetFromStyle Uses

func (ld *LayoutData) SetFromStyle(ls *LayoutStyle)

func (*LayoutData) SizePrefOrMax Uses

func (ld *LayoutData) SizePrefOrMax() Vec2D

SizePrefOrMax returns the pref size if non-zero, else the max-size -- use for style-based constraints during initial sizing (e.g., word wrapping)

func (*LayoutData) UpdateSizes Uses

func (ld *LayoutData) UpdateSizes()

UpdateSizes updates our sizes based on AllocSize and Max constraints, etc

type LayoutStyle Uses

type LayoutStyle struct {
    ZIndex         int         `xml:"z-index" desc:"ordering factor for rendering depth -- lower numbers rendered first -- sort children according to this factor"`
    AlignH         Align       `xml:"horizontal-align" desc:"horizontal alignment -- for widget layouts -- not a standard css property"`
    AlignV         Align       `xml:"vertical-align" desc:"vertical alignment -- for widget layouts -- not a standard css property"`
    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 `xml:"padding" desc:"transparent space around central content of box -- todo: if 4 values it is top, right, bottom, left; 3 is top, right&left, bottom; 2 is top & bottom, right and left"`
    Overflow       Overflow    `xml:"overflow" desc:"what to do with content that overflows -- default is Auto add of scrollbars as needed -- todo: can have separate -x -y values"`
    Columns        int         `xml:"columns" alt:"grid-cols" desc:"number of columns to use in a grid layout -- used as a constraint in layout if individual elements do not specify their row, column positions"`
    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         `xml:"row-span" desc:"specifies the number of sequential rows that this element should occupy within a grid layout (todo: not currently supported)"`
    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"`
}

LayoutStyle contains style preferences on the layout of the element.

func (*LayoutStyle) AlignDim Uses

func (ls *LayoutStyle) AlignDim(d Dims2D) Align

return the alignment for given dimension

func (*LayoutStyle) Defaults Uses

func (ls *LayoutStyle) Defaults()

func (*LayoutStyle) MaxSizeDots Uses

func (ls *LayoutStyle) MaxSizeDots() Vec2D

size max settings, in dots

func (*LayoutStyle) MinSizeDots Uses

func (ls *LayoutStyle) MinSizeDots() Vec2D

size min settings, in dots

func (*LayoutStyle) PosDots Uses

func (ls *LayoutStyle) PosDots() Vec2D

position settings, in dots

func (*LayoutStyle) SetStylePost Uses

func (ls *LayoutStyle) SetStylePost(props ki.Props)

func (*LayoutStyle) SizeDots Uses

func (ls *LayoutStyle) SizeDots() Vec2D

size settings, in dots

type Layouts Uses

type Layouts int32

Layouts are the different types of layouts

const (
    // LayoutHoriz arranges items horizontally across a row
    LayoutHoriz Layouts = iota

    // LayoutVert arranges items vertically in a column
    LayoutVert

    // LayoutGrid arranges items according to a regular grid
    LayoutGrid

    // LayoutHorizFlow arranges items horizontally across a row, overflowing
    // vertically as needed
    LayoutHorizFlow

    // LayoutVertFlow arranges items vertically within a column, overflowing
    // horizontally as needed
    LayoutVertFlow

    // LayoutStacked arranges items stacked on top of each other -- Top index
    // indicates which to show -- overall size accommodates largest in each
    // dimension
    LayoutStacked

    // LayoutNil is a nil layout -- doesn't do anything -- for cases when a
    // parent wants to take over the job of the layout
    LayoutNil

    LayoutsN
)

func (*Layouts) FromString Uses

func (i *Layouts) FromString(s string) error

func (Layouts) MarshalJSON Uses

func (ev Layouts) MarshalJSON() ([]byte, error)

func (Layouts) String Uses

func (i Layouts) String() string

func (*Layouts) UnmarshalJSON Uses

func (ev *Layouts) UnmarshalJSON(b []byte) error

type LineCap Uses

type LineCap int

end-cap of a line: stroke-linecap property in SVG

const (
    LineCapButt LineCap = iota
    LineCapRound
    LineCapSquare
    // rasterx extension
    LineCapCubic
    // rasterx extension
    LineCapQuadratic
    LineCapN
)

func (*LineCap) FromString Uses

func (i *LineCap) FromString(s string) error

func (LineCap) MarshalJSON Uses

func (ev LineCap) MarshalJSON() ([]byte, error)

func (LineCap) String Uses

func (i LineCap) String() string

func (*LineCap) UnmarshalJSON Uses

func (ev *LineCap) UnmarshalJSON(b []byte) error

type LineJoin Uses

type LineJoin int

the way in which lines are joined together: stroke-linejoin property in SVG

const (
    LineJoinMiter LineJoin = iota
    LineJoinMiterClip
    LineJoinRound
    LineJoinBevel
    LineJoinArcs
    // rasterx extension
    LineJoinArcsClip
    LineJoinN
)

func (*LineJoin) FromString Uses

func (i *LineJoin) FromString(s string) error

func (LineJoin) MarshalJSON Uses

func (ev LineJoin) MarshalJSON() ([]byte, error)

func (LineJoin) String Uses

func (i LineJoin) String() string

func (*LineJoin) UnmarshalJSON Uses

func (ev *LineJoin) UnmarshalJSON(b []byte) error

type MakeMenuFunc Uses

type MakeMenuFunc func(obj ki.Ki, m *Menu)

MakeMenuFunc is a callback for making a menu on demand, receives the object calling this function (typically an Action or Button) and the menu

type Matrix2D Uses

type Matrix2D struct {
    XX, YX, XY, YY, X0, Y0 float32
}

func Identity2D Uses

func Identity2D() Matrix2D

func Rotate2D Uses

func Rotate2D(angle float32) Matrix2D

func Scale2D Uses

func Scale2D(x, y float32) Matrix2D

func Shear2D Uses

func Shear2D(x, y float32) Matrix2D

func Skew2D Uses

func Skew2D(x, y float32) Matrix2D

func Translate2D Uses

func Translate2D(x, y float32) Matrix2D

func (Matrix2D) ExtractRot Uses

func (a Matrix2D) ExtractRot() float32

ExtractRot extracts the rotation component from a given matrix

func (Matrix2D) ExtractScale Uses

func (a Matrix2D) ExtractScale() (scx, scy float32)

ExtractXYScale extracts the X and Y scale factors after undoing any rotation present -- i.e., in the original X, Y coordinates

func (Matrix2D) Multiply Uses

func (a Matrix2D) Multiply(b Matrix2D) Matrix2D

func (Matrix2D) Rotate Uses

func (a Matrix2D) Rotate(angle float32) Matrix2D

func (Matrix2D) Scale Uses

func (a Matrix2D) Scale(x, y float32) Matrix2D

func (*Matrix2D) SetString Uses

func (a *Matrix2D) SetString(str string) error

SetString processes the standard SVG-style transform strings

func (Matrix2D) Shear Uses

func (a Matrix2D) Shear(x, y float32) Matrix2D

func (Matrix2D) Skew Uses

func (a Matrix2D) Skew(x, y float32) Matrix2D

func (Matrix2D) ToRasterx Uses

func (a Matrix2D) ToRasterx() rasterx.Matrix2D

func (Matrix2D) TransformPoint Uses

func (a Matrix2D) TransformPoint(x, y float32) (tx, ty float32)

func (Matrix2D) TransformPointToInt Uses

func (a Matrix2D) TransformPointToInt(x, y float32) (tx, ty int)

func (Matrix2D) TransformPointVec2D Uses

func (a Matrix2D) TransformPointVec2D(v Vec2D) Vec2D

func (Matrix2D) TransformVector Uses

func (a Matrix2D) TransformVector(x, y float32) (tx, ty float32)

func (Matrix2D) TransformVectorVec2D Uses

func (a Matrix2D) TransformVectorVec2D(v Vec2D) Vec2D

func (Matrix2D) Translate Uses

func (a Matrix2D) Translate(x, y float32) Matrix2D
type Menu ki.Slice

Menu is a slice list of Node2D actions, which can contain sub-actions (though it can contain anything -- it is just added to a column layout and displayed in a popup) -- don't use stretchy sizes in general for these items!

func (m *Menu) AddAction(opts ActOpts, sigTo ki.Ki, fun ki.RecvFunc) *Action

AddAction adds an action to the menu using given options, and connects the action signal to given receiver object and function, along with given data which is stored on the action and then passed in the action signal. Optional updateFunc is a function called prior to showing the menu to update the actions (enabled or not typically).

func (m *Menu) AddAppMenu(win *Window)

AddAppMenu adds an "app" menu to the menu -- calls AddStdAppMenu and then CustomAppMenuFunc if non-nil

func (m *Menu) AddCopyCutPaste(win *Window)

AddCopyCutPaste adds a Copy, Cut, Paste actions that just emit the corresponding keyboard shortcut. Paste is automatically enabled by clipboard having something in it.

func (m *Menu) AddCopyCutPasteDupe(win *Window)

AddCopyCutPasteDupe adds a Copy, Cut, Paste, and Duplicate actions that just emit the corresponding keyboard shortcut. Paste is automatically enabled by clipboard having something in it.

func (m *Menu) AddLabel(lbl string) *Label

AddLabel adds a label to the menu

func (m *Menu) AddSeparator(name string) *Separator

AddSeparator adds a separator at the next point in the menu (name is just internal label of element, defaults to 'sep' if empty)

func (m *Menu) AddStdAppMenu(win *Window)

AddStdAppMenu adds a standard set of menu items for application-level control.

func (m *Menu) AddWindowsMenu(win *Window)

AddWindowsMenu adds menu items for current main and dialog windows.

func (m *Menu) FindActionByName(name string) (*Action, bool)

FindActionByName finds an action on the menu, or any sub-menu, with given name (exact match) -- this is not the Text label but the Name of the element (for AddAction items, this is the same as Label or Icon (if Label is empty)) -- returns false if not found

func (m *Menu) InsertActionAfter(after string, opts ActOpts, sigTo ki.Ki, fun ki.RecvFunc) *Action

InsertActionAfter adds an action to the menu after existing item of given name, using given options, and connects the action signal to given receiver object and function, along with given data which is stored on the action and then passed in the action signal. Optional updateFunc is a function called prior to showing the menu to update the actions (enabled or not typically). If name not found, adds to end of list..

func (m *Menu) InsertActionBefore(before string, opts ActOpts, sigTo ki.Ki, fun ki.RecvFunc) *Action

InsertActionBefore adds an action to the menu before existing item of given name, using given options, and connects the action signal to given receiver object and function, along with given data which is stored on the action and then passed in the action signal. Optional updateFunc is a function called prior to showing the menu to update the actions (enabled or not typically). If name not found, adds to end of list..

func (m Menu) MarshalJSON() ([]byte, error)
func (m *Menu) SetAction(ac *Action, opts ActOpts, sigTo ki.Ki, fun ki.RecvFunc)

SetAction sets properties of given action

func (m *Menu) SetShortcuts(win *Window)

SetShortcuts sets the shortcuts to given window -- call when the menu has been attached to a window

func (m *Menu) UnmarshalJSON(b []byte) error
func (m *Menu) UpdateActions()

UpdateActions calls update function on all the actions in the menu, and any of their sub-actions

type MenuBar struct {
    Layout
    MainMenu    bool               `desc:"is this the main menu bar for a window?  controls whether displayed on macOS"`
    OSMainMenus map[string]*Action `json:"-" xml:"-" desc:"map of main menu items for callback from OS main menu (MacOS specific)"`
}

MenuBar is a Layout (typically LayoutHoriz) that renders a gradient background and has convenience methods for adding menus.

func (mb *MenuBar) ConfigMenus(menus []string)

ConfigMenus configures Action items as children of MenuBar with the given names, which function as the main menu panels for the menu bar (File, Edit, etc). Access the resulting menus as .KnownChildByName("name").(*Action).

func (m *MenuBar) FindActionByName(name string) (*Action, bool)

FindActionByName finds an action on the menu, or any sub-menu, with given name (exact match) -- this is not the Text label but the Name of the element (for AddAction items, this is the same as Label or Icon (if Label is empty)) -- returns false if not found

func (mb *MenuBar) Layout2D(parBBox image.Rectangle, iter int) bool
func (mb *MenuBar) MainMenuUpdateActives(win *Window)

MainMenuUpdateActives updates the active state of all menu items, based on active state of corresponding Actions (action self-update functions are called via UpdateActions) -- can be called by method of same name on Window.

func (mb *MenuBar) MenuBarStdRender()

MenuBarStdRender does the standard rendering of the bar

func (mb *MenuBar) Render2D()
func (mb *MenuBar) SetMainMenu(win *Window)

SetMainMenu sets this menubar as the main menu of given window -- called by Window.MainMenuUpdated.

func (mb *MenuBar) SetMainMenuSub(osmm oswin.MainMenu, subm oswin.Menu, am *Action)

SetMainMenuSub iterates over sub-menus, adding items to overall main menu.

func (mb *MenuBar) ShowMenuBar() bool
func (mb *MenuBar) Size2D(iter int)
func (mb *MenuBar) UpdateActions()

UpdateActions calls UpdateFunc on all actions in menu -- individual menus are automatically updated just prior to menu popup

type MenuButton struct {
    ButtonBase
}
func (mb *MenuButton) ButtonAsBase() *ButtonBase
func (mb *MenuButton) ConfigParts()

type MetaData2D Uses

type MetaData2D struct {
    Node2DBase
    MetaData string
}

MetaData2D is used for holding meta data info

type NRGBAf32 Uses

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

func (NRGBAf32) RGBA Uses

func (c NRGBAf32) RGBA() (r, g, b, a uint32)

Implements the color.Color interface

type Node2D Uses

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

    // AsWidget returns WidgetBase if this is a WidgetBase-derived node, else nil.
    AsWidget() *WidgetBase

    // Init2D initializes a node -- grabs active Viewport etc -- must call
    // InitNodeBase as first step set basic inits including setting Viewport
    // -- all code here must be robust to being called repeatedly.
    Init2D()

    // Style2D: In a MeFirst downward pass, all properties are cached out in
    // an inherited manner, and incorporating any css styles, into either the
    // Paint or Style object for each Node, depending on the type of node (SVG
    // does Paint, Widget does Style).  Only done once after structural
    // changes -- styles are not for dynamic changes.
    Style2D()

    // Size2D: 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(iter int)

    // Layout2D: MeFirst downward pass (each node calls on its children at
    // appropriate point) with relevant parent BBox that the children are
    // constrained to render within -- they then intersect this BBox with
    // their own BBox (from BBox2D) -- typically just call Layout2DBase for
    // default behavior -- and add parent position to AllocPos, and then
    // return call to Layout2DChildren. Layout does all its sizing and
    // positioning of children in this pass, based on the Size2D data gathered
    // bottom-up and constraints applied top-down from higher levels.
    // Typically only a single iteration is required (iter = 0) but multiple
    // are supported (needed for word-wrapped text or flow layouts) -- return
    // = true indicates another iteration required (pass this up the chain).
    Layout2D(parBBox image.Rectangle, iter int) bool

    // Move2D: optional MeFirst downward pass to move all elements by given
    // delta -- used for scrolling -- the layout pass assigns canonical
    // positions, saved in AllocPosOrig and BBox, and this adds the given
    // delta to that AllocPosOrig -- each node must call ComputeBBox2D to
    // update its bounding box information given the new position.
    Move2D(delta image.Point, parBBox image.Rectangle)

    // BBox2D: compute the raw bounding box of this node relative to its
    // parent viewport -- called during Layout2D to set node BBox field, which
    // is then used in setting WinBBox and VpBBox.
    BBox2D() image.Rectangle

    // Compute VpBBox and WinBBox from BBox, given parent VpBBox -- most nodes
    // call ComputeBBox2DBase but viewports require special code -- called
    // during Layout and Move.
    ComputeBBox2D(parBBox image.Rectangle, delta image.Point)

    // ChildrenBBox2D: compute the bbox available to my children (content),
    // adjusting for margins, border, padding (BoxSpace) taken up by me --
    // operates on the existing VpBBox for this node -- this is what is passed
    // down as parBBox do the children's Layout2D.
    ChildrenBBox2D() image.Rectangle

    // Render2D: Final rendering pass, each node is fully responsible for
    // calling Render2D on its own children, to provide maximum flexibility
    // (see Render2DChildren for default impl) -- bracket the render calls in
    // PushBounds / PopBounds and a false from PushBounds indicates that
    // VpBBox is empty and no rendering should occur.  Typically call
    // ConnectEvents2D to set up connections to receive window events if
    // visible, and disconnect if not.
    Render2D()

    // ConnectEvents2D: setup connections to window events -- called in
    // Render2D if in bounds.  It can be useful to create modular methods for
    // different event types that can then be mix-and-matched in any more
    // specialized types.
    ConnectEvents2D()

    // FocusChanged2D is called on node for changes in focus -- see the
    // FocusChanges values.
    FocusChanged2D(change FocusChanges)

    // HasFocus2D returns true if this node has keyboard focus and should
    // receive keyboard events -- typically this just returns HasFocus based
    // on the Window-managed HasFocus flag, but some types may want to monitor
    // all keyboard activity for certain key keys..
    HasFocus2D() bool

    // FindNamedElement searches for given named element in this node or in
    // parent nodes.  Used for url(#name) references.
    FindNamedElement(name string) Node2D

    // MakeContextMenu creates the context menu items (typically Action
    // elements, but it can be anything) for a given widget, typically
    // activated by the right mouse button or equivalent.  Widget has a
    // function parameter that can be set to add context items (e.g., by Views
    // or other complex widgets) to extend functionality.
    MakeContextMenu(menu *Menu)

    // ContextMenuPos returns the default position for popup menus --
    // by default in the middle of the WinBBox, but can be adapted as
    // appropriate for different widgets.
    ContextMenuPos() image.Point

    // ContextMenu displays the context menu of various actions to perform on
    // a node -- returns immediately, and actions are all executed directly
    // (later) via the action signals.  Calls MakeContextMenu and
    // ContextMenuPos.
    ContextMenu()
}

Node2D is the interface for all 2D nodes -- defines the stages of building and rendering the 2D scenegraph

var CurStyleNode2D Node2D

CurStyleNode2D is always set to the current node that is being styled -- used for finding url references -- only active during a Style pass

type Node2DBase Uses

type Node2DBase struct {
    NodeBase
    Viewport *Viewport2D `json:"-" xml:"-" view:"-" desc:"our viewport -- set in Init2D (Base typically) and used thereafter"`
}

Base struct node for 2D rendering tree -- renders to a bitmap using Paint rendering functions operating on the RenderState in the parent Viewport

For Widget / Layout nodes, rendering is done in 5 separate passes:

	0. Init2D: In a MeFirst downward pass, Viewport pointer is set, styles are
	initialized, and any other widget-specific init is done.

	1. 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.

	2. 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.

	3. Layout2D: MeFirst downward pass (each node calls on its children at
	appropriate point) with relevant parent BBox that the children are
	constrained to render within -- they then intersect this BBox with their
	own BBox (from BBox2D) -- typically just call Layout2DBase for default
	behavior -- and add parent position to AllocPos. Layout does all its
	sizing and positioning of children in this pass, based on the Size2D data
	gathered bottom-up and constraints applied top-down from higher levels.
	Typically only a single iteration is required but multiple are supported
	(needed for word-wrapped text or flow layouts).

	4. Render2D: Final rendering pass, each node is fully responsible for
	rendering its own children, to provide maximum flexibility (see
	Render2DChildren) -- bracket the render calls in PushBounds / PopBounds
	and a false from PushBounds indicates that VpBBox is empty and no
	rendering should occur.  Nodes typically connect / disconnect to receive
	events from the window based on this visibility here.

    * Move2D: optional pass invoked by scrollbars to move elements relative to
      their previously-assigned positions.

    * SVG nodes skip the Size and Layout passes, and render directly into
      parent SVG viewport

func KiToNode2DBase Uses

func KiToNode2DBase(k ki.Ki) *Node2DBase

KiToNode2DBase converts Ki to a *Node2DBase -- use when known to be at least of this type, not-nil, etc

func (*Node2DBase) AsLayout2D Uses

func (nb *Node2DBase) AsLayout2D() *Layout

func (*Node2DBase) AsNode2D Uses

func (nb *Node2DBase) AsNode2D() *Node2DBase

func (*Node2DBase) AsViewport2D Uses

func (nb *Node2DBase) AsViewport2D() *Viewport2D

func (*Node2DBase) AsWidget Uses

func (nb *Node2DBase) AsWidget() *WidgetBase

func (*Node2DBase) BBox2D Uses

func (nb *Node2DBase) BBox2D() image.Rectangle

func (*Node2DBase) BBoxReport Uses

func (nb *Node2DBase) BBoxReport() string

BBoxReport reports on all the bboxes for everything in the tree

func (*Node2DBase) ChildrenBBox2D Uses

func (nb *Node2DBase) ChildrenBBox2D() image.Rectangle

func (*Node2DBase) ComputeBBox2D Uses

func (nb *Node2DBase) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)

func (*Node2DBase) ComputeBBox2DBase Uses

func (nb *Node2DBase) ComputeBBox2DBase(parBBox image.Rectangle, delta image.Point)

ComputeBBox2DBase -- computes the VpBBox and WinBBox from BBox, with whatever delta may be in effect

func (*Node2DBase) ConnectEvent Uses

func (nb *Node2DBase) ConnectEvent(et oswin.EventType, pri EventPris, fun ki.RecvFunc)

ConnectEvent connects this node to receive a given type of GUI event signal from the parent window -- typically connect only visible nodes, and disconnect when not visible

func (*Node2DBase) ConnectEvents2D Uses

func (nb *Node2DBase) ConnectEvents2D()

func (*Node2DBase) ConnectToViewport Uses

func (nb *Node2DBase) ConnectToViewport()

ConnectToViewport connects the view node's update signal to the viewport as a receiver, so that when the view is updated, it triggers the viewport to re-render it -- this is automatically called in PushBounds, and disconnected with DisconnectAllEvents, so it only occurs for rendered nodes

func (*Node2DBase) ContainsFocus Uses

func (nb *Node2DBase) ContainsFocus() bool

ContainsFocus returns true if this widget contains the current focus widget as maintained in the Window

func (*Node2DBase) ContextMenu Uses

func (nb *Node2DBase) ContextMenu()

func (*Node2DBase) ContextMenuPos Uses

func (nb *Node2DBase) ContextMenuPos() (pos image.Point)

func (*Node2DBase) DisconnectAllEvents Uses

func (nb *Node2DBase) DisconnectAllEvents(pri EventPris)

DisconnectAllEvents disconnects node from all window events -- typically disconnect when not visible -- pri is priority -- pass AllPris for all priorities

func (*Node2DBase) DisconnectAllEventsTree Uses

func (nb *Node2DBase) DisconnectAllEventsTree(win *Window)

DisconnectAllEventsTree disconnect node and all of its children (and so on) from all events -- call for to-be-destroyed nodes (will happen in Ki destroy anyway, but more efficient here)

func (*Node2DBase) DisconnectEvent Uses

func (nb *Node2DBase) DisconnectEvent(et oswin.EventType, pri EventPris)

DisconnectEvent disconnects this receiver from receiving given event type -- pri is priority -- pass AllPris for all priorities -- see also DisconnectAllEvents

func (*Node2DBase) FindNamedElement Uses

func (nb *Node2DBase) FindNamedElement(name string) Node2D

func (*Node2DBase) FocusChanged2D Uses

func (nb *Node2DBase) FocusChanged2D(change FocusChanges)

func (*Node2DBase) FocusNext Uses

func (nb *Node2DBase) FocusNext()

FocusNext moves the focus onto the next item

func (*Node2DBase) FullRender2DTree Uses

func (nb *Node2DBase) FullRender2DTree()

FullRender2DTree does a full render of the tree

func (*Node2DBase) GrabFocus Uses

func (nb *Node2DBase) GrabFocus()

GrabFocus grabs the keyboard input focus on this item

func (*Node2DBase) HasFocus2D Uses

func (nb *Node2DBase) HasFocus2D() bool

func (*Node2DBase) Init2D Uses

func (nb *Node2DBase) Init2D()

func (*Node2DBase) Init2DTree Uses

func (nb *Node2DBase) Init2DTree()

Init2DTree initializes scene graph tree from node it is called on -- only needs to be done once but must be robust to repeated calls -- use a flag if necessary -- needed after structural updates to ensure all nodes are updated

func (*Node2DBase) Layout2D Uses

func (nb *Node2DBase) Layout2D(parBBox image.Rectangle, iter int) bool

func (*Node2DBase) Layout2DChildren Uses

func (nb *Node2DBase) Layout2DChildren(iter int) bool

Layout2DChildren does layout on all of node's children, giving them the ChildrenBBox2D -- default call at end of Layout2D. Passes along whether any of the children need a re-layout -- typically Layout2D just returns this.

func (*Node2DBase) Layout2DTree Uses

func (nb *Node2DBase) Layout2DTree()

Layout2DTree does layout pass -- each node iterates over children for maximum control -- this starts with parent VpBBox -- can be called de novo. Handles multiple iterations if needed.

func (*Node2DBase) MakeContextMenu Uses

func (nb *Node2DBase) MakeContextMenu(m *Menu)

func (*Node2DBase) Move2D Uses

func (nb *Node2DBase) Move2D(delta image.Point, parBBox image.Rectangle)

func (*Node2DBase) Move2DChildren Uses

func (nb *Node2DBase) Move2DChildren(delta image.Point)

Move2dChildren moves all of node's children, giving them the ChildrenBBox2D -- default call at end of Move2D

func (*Node2DBase) ParentLayout Uses

func (nb *Node2DBase) ParentLayout() *Layout

ParentLayout returns the parent layout

func (*Node2DBase) ParentPaint Uses

func (nb *Node2DBase) ParentPaint() *Paint

ParentPaint returns the Paint from parent, if available

func (*Node2DBase) ParentReRenderAnchor Uses

func (nb *Node2DBase) ParentReRenderAnchor() Node2D

ParentReRenderAnchor returns parent that is a ReRenderAnchor -- for optimized re-rendering

func (*Node2DBase) ParentScrollLayout Uses

func (nb *Node2DBase) ParentScrollLayout() *Layout

ParentScrollLayout returns the parent layout that has active scrollbars

func (*Node2DBase) ParentStyle Uses

func (nb *Node2DBase) ParentStyle() *Style

ParentStyle returns parent's style or nil if not avail

func (*Node2DBase) ParentViewport Uses

func (nb *Node2DBase) ParentViewport() *Viewport2D

ParentViewport returns the parent viewport -- uses AsViewport2D() method on Node2D interface

func (*Node2DBase) ParentWindow Uses

func (nb *Node2DBase) ParentWindow() *Window

ParentWindow returns the parent window for this node

func (*Node2DBase) Render2D Uses

func (nb *Node2DBase) Render2D()

func (*Node2DBase) Render2DChildren Uses

func (nb *Node2DBase) Render2DChildren()

Render2DChildren renders all of node's children -- default call at end of Render2D()

func (*Node2DBase) Render2DTree Uses

func (nb *Node2DBase) Render2DTree()

Render2DTree just calls on parent node and it takes full responsibility for managing the children -- this allows maximum flexibility for order etc of rendering

func (*Node2DBase) ScrollToMe Uses

func (nb *Node2DBase) ScrollToMe() bool

ScrollToMe tells my parent layout (that has scroll bars) to scroll to keep this widget in view -- returns true if scrolled

func (*Node2DBase) SetWinBBox Uses

func (nb *Node2DBase) SetWinBBox()

set our window-level BBox from vp and our bbox

func (*Node2DBase) Size2D Uses

func (nb *Node2DBase) Size2D(iter int)

func (*Node2DBase) Size2DTree Uses

func (nb *Node2DBase) Size2DTree(iter int)

Size2DTree does the sizing as a depth-first pass

func (*Node2DBase) StartFocus Uses

func (nb *Node2DBase) StartFocus()

StartFocus specifies this widget to give focus to when the window opens

func (*Node2DBase) Style2D Uses

func (nb *Node2DBase) Style2D()

func (*Node2DBase) Style2DTree Uses

func (nb *Node2DBase) Style2DTree()

Style2DTree styles scene graph tree from node it is called on -- only needs to be done after a structural update in case inherited options changed

type Node3DBase Uses

type Node3DBase struct {
    NodeBase
}

basic component node for 3D rendering -- has a 3D transform

type NodeBase Uses

type NodeBase struct {
    ki.Node
    Class   string          `desc:"user-defined class name used primarily for attaching CSS styles to different display elements"`
    CSS     ki.Props        `xml:"css" desc:"cascading style sheet at this level -- these styles apply here and to everything below, until superceded -- use .class and #name Props elements to apply entire styles to given elements, and type for element type"`
    CSSAgg  ki.Props        `json:"-" xml:"-" view:"no-inline" desc:"aggregated css properties from all higher nodes down to me"`
    BBox    image.Rectangle `json:"-" xml:"-" desc:"raw original 2D bounding box for the object within its parent viewport -- used for computing VpBBox and WinBBox -- this is not updated by Move2D, whereas VpBBox etc are"`
    ObjBBox image.Rectangle `json:"-" xml:"-" desc:"full object bbox -- this is BBox + Move2D delta, but NOT intersected with parent's parBBox -- used for computing color gradients or other object-specific geometry computations"`
    VpBBox  image.Rectangle `json:"-" xml:"-" desc:"2D bounding box for region occupied within immediate parent Viewport object that we render onto -- these are the pixels we draw into, filtered through parent bounding boxes -- used for render Bounds clipping"`
    WinBBox image.Rectangle `json:"-" xml:"-" desc:"2D bounding box for region occupied within parent Window object, projected all the way up to that -- these are the coordinates where we receive events, relative to the window"`
}

NodeBase is the base struct type for GoGi graphical interface system, containing infrastructure for both 2D and 3D scene graph nodes

func (*NodeBase) CanFocus Uses

func (nb *NodeBase) CanFocus() bool

CanFocus checks if this node can recieve keyboard focus

func (*NodeBase) ClearFullReRender Uses

func (nb *NodeBase) ClearFullReRender()

ClearFullReRender clears node as needing a full ReRender

func (*NodeBase) ClearInactive Uses

func (nb *NodeBase) ClearInactive()

ClearInactive clears the node as inactive

func (*NodeBase) ClearSelected Uses

func (nb *NodeBase) ClearSelected()

ClearSelected sets the node as not selected

func (*NodeBase) FirstContainingPoint Uses

func (nb *NodeBase) FirstContainingPoint(pt image.Point, leavesOnly bool) ki.Ki

FirstContainingPoint finds the first node whose WinBBox contains the given point -- nil if none. If leavesOnly is set then only nodes that have no nodes (leaves, terminal nodes) will be considered

func (*NodeBase) HasFocus Uses

func (nb *NodeBase) HasFocus() bool

HasFocus checks if the current node is flagged as having keyboard focus

func (*NodeBase) HasNoLayout Uses

func (nb *NodeBase) HasNoLayout() bool

HasNoLayout checks if the current node is flagged as not needing layout

func (*NodeBase) IsActive Uses

func (nb *NodeBase) IsActive() bool

IsActive tests if this node is NOT flagged as Inactive.

func (*NodeBase) IsDragging Uses

func (nb *NodeBase) IsDragging() bool

IsDragging tests if the current node is currently flagged as receiving dragging events -- flag set by window

func (*NodeBase) IsInactive Uses

func (nb *NodeBase) IsInactive() bool

IsInactive tests if this node is flagged as Inactive. if so, behave (e.g., ignore events except select, context menu) and style appropriately

func (*NodeBase) IsInstaDrag Uses

func (nb *NodeBase) IsInstaDrag() bool

IsInstaDrag tests if the current node has InstaDrag property set

func (*NodeBase) IsOverlay Uses

func (nb *NodeBase) IsOverlay() bool

IsOverlay returns whether node is an overlay -- lives in special viewport and renders without bounds

func (*NodeBase) IsReRenderAnchor Uses

func (nb *NodeBase) IsReRenderAnchor() bool

IsReRenderAnchor returns whethers the current node is a ReRenderAnchor

func (*NodeBase) IsSelected Uses

func (nb *NodeBase) IsSelected() bool

IsSelected tests if this node is flagged as Selected

func (*NodeBase) NeedsFullReRender Uses

func (nb *NodeBase) NeedsFullReRender() bool

NeedsFullReRender checks if node has said it needs full re-render

func (*NodeBase) ParentCSSAgg Uses

func (nb *NodeBase) ParentCSSAgg() *ki.Props

ParentCSSAgg returns parent's CSSAgg styles or nil if not avail

func (*NodeBase) PointToRelPos Uses

func (nb *NodeBase) PointToRelPos(pt image.Point) image.Point

translate a point in global pixel coords into relative position within node

func (*NodeBase) SetActiveState Uses

func (nb *NodeBase) SetActiveState(act bool)

SetActiveState sets flag as active or not based on act arg -- positive logic is easier to understand.

func (*NodeBase) SetActiveStateUpdt Uses

func (nb *NodeBase) SetActiveStateUpdt(act bool)

SetActiveStateUpdt sets flag as active or not based on act arg -- positive logic is easier to understand -- does UpdateSig if state changed.

func (*NodeBase) SetAsOverlay Uses

func (nb *NodeBase) SetAsOverlay()

SetOverlay flags this node as an overlay -- lives in special viewport and renders without bounds

func (*NodeBase) SetCanFocusIfActive Uses

func (nb *NodeBase) SetCanFocusIfActive()

SetCanFocusIfActive sets CanFocus flag only if node is active (inactive nodes don't need focus typically)

func (*NodeBase) SetFullReRender Uses

func (nb *NodeBase) SetFullReRender()

SetFullReRender sets node as needing a full ReRender

func (*NodeBase) SetInactive Uses

func (nb *NodeBase) SetInactive()

SetInactive sets the node as inactive

func (*NodeBase) SetInactiveState Uses

func (nb *NodeBase) SetInactiveState(inact bool)

SetInactiveState sets flag as inactive or not based on inact arg

func (*NodeBase) SetInactiveStateUpdt Uses

func (nb *NodeBase) SetInactiveStateUpdt(inact bool)

SetInactiveStateUpdt sets flag as inactive or not based on inact arg, and does UpdateSig if state changed.

func (*NodeBase) SetReRenderAnchor Uses

func (nb *NodeBase) SetReRenderAnchor()

SetReRenderAnchor sets node as a ReRenderAnchor

func (*NodeBase) SetSelected Uses

func (nb *NodeBase) SetSelected()

SetSelected sets the node as selected

func (*NodeBase) SetSelectedState Uses

func (nb *NodeBase) SetSelectedState(sel bool)

SetSelectedState set flag as selected or not based on sel arg

func (*NodeBase) SetStdXMLAttr Uses

func (nb *NodeBase) SetStdXMLAttr(name, val string) bool

SetStdXMLAttr sets standard attributes of node given XML-style name / attribute values (e.g., from parsing XML / SVG files) -- returns true if handled

func (*NodeBase) StyleProps Uses

func (nb *NodeBase) StyleProps(selector string) ki.Props

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 Uses

type NodeFlags int32

NodeFlags define gi node bitflags for tracking common high-frequency GUI state, mostly having to do with event processing -- use properties map for less frequently used information -- uses ki Flags field (64 bit capacity)

const (
    // button is checkable -- enables display of check control
    ButtonFlagCheckable NodeFlags = NodeFlagsN + iota

    // 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 (
    // NoLayout means that this node does not participate in the layout
    // process (Size, Layout, Move) -- set by e.g., SVG nodes
    NoLayout NodeFlags = NodeFlags(ki.FlagsN) + iota

    // EventsConnected: this node has been connected to receive events from
    // the window -- to optimize event processing, connections are typically
    // only established for visible nodes during render, and disconnected when
    // not visible
    EventsConnected

    // CanFocus: can this node accept focus to receive keyboard input events
    // -- set by default for typical nodes that do so, but can be overridden,
    // including by the style 'can-focus' property
    CanFocus

    // HasFocus: does this node currently have the focus for keyboard input
    // events?  use tab / alt tab and clicking events to update focus -- see
    // interface on Window
    HasFocus

    // FullReRender indicates that a full re-render is required due to nature
    // of update event -- otherwise default is local re-render -- used
    // internally for nodes to determine what to do on the ReRender step
    FullReRender

    // ReRenderAnchor: this node has a static size, and repaints its
    // background -- any children under it that need to dynamically resize on
    // a ReRender (Update) can refer the update up to rerendering this node,
    // instead of going further up the tree -- e.g., true of Frame's within a
    // SplitView
    ReRenderAnchor

    // Inactive disables interaction with widgets or other nodes (i.e., they
    // are read-only) -- they should indicate this inactive state in an
    // appropriate way, and each node should interpret events appropriately
    // based on this state (select and context menu events should still be
    // generated)
    Inactive

    // Selected indicates that this node has been selected by the user --
    // widely supported across different nodes
    Selected

    // MouseHasEntered indicates that the MouseFocusEvent Enter was previously
    // registered on this node
    MouseHasEntered

    // DNDHasEntered indicates that the DNDFocusEvent Enter was previously
    // registered on this node
    DNDHasEntered

    // NodeDragging indicates this node is currently dragging -- win.Dragging
    // set to this node
    NodeDragging

    // InstaDrag indicates this node should start dragging immediately when
    // clicked -- otherwise there is a time-and-distance threshold to the
    // start of dragging -- use this for controls that are small and are
    // primarily about dragging (e.g., the Splitter handle)
    InstaDrag

    // Overlay indicates this node is an overlay -- affects how it renders
    Overlay

    // can extend node flags from here
    NodeFlagsN
)
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

    // VpFlagCompleter means viewport is serving as a popup menu for code completion --
    // only applies if the VpFlagMenu is also set
    VpFlagCompleter

    // VpFlagTooltip means viewport is serving as a tooltip
    VpFlagTooltip

    // VpFlagPopupDestroyAll means that if this is a popup, then destroy all
    // the children when it is deleted -- otherwise children below the main
    // layout under the vp will not be destroyed -- it is up to the caller to
    // manage those (typically these are reusable assets)
    VpFlagPopupDestroyAll

    // VpFlagSVG means that this viewport is an SVG viewport -- SVG elements
    // look for this for re-rendering
    VpFlagSVG

    // VpFlagDoingFullRender means that this viewport is currently doing a
    // full render -- can be used by elements to drive deep rebuild in case
    // underlying data has changed.
    VpFlagDoingFullRender
)

VpFlag flags extend NodeBase NodeFlags to hold viewport state

func StringToNodeFlags Uses

func StringToNodeFlags(s string) (NodeFlags, error)

func (NodeFlags) String Uses

func (i NodeFlags) String() string

type Overflow Uses

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 Uses

func (i *Overflow) FromString(s string) error

func (Overflow) MarshalJSON Uses

func (ev Overflow) MarshalJSON() ([]byte, error)

func (Overflow) String Uses

func (i Overflow) String() string

func (*Overflow) UnmarshalJSON Uses

func (ev *Overflow) UnmarshalJSON(b []byte) error

type Paint Uses

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    `desc:"font also has global opacity setting, along with generic color, background-color settings, which can be copied into stroke / fill as needed"`
    TextStyle   TextStyle    `desc:"font also has global opacity setting, along with generic color, background-color settings, which can be copied into stroke / fill as needed"`
    VecEff      VectorEffect `xml:"vector-effect" desc:"various rendering special effects settings"`
    XForm       Matrix2D     `xml:"transform" desc:"our additions to transform -- pushed to render state"`
    // contains filtered or unexported fields
}

Paint provides the styling parameters and methods for rendering on to an RGBA image -- all dynamic rendering state is maintained in the RenderState. Text rendering is handled separately in TextRender, but it depends minimally on styling parameters in FontStyle

var PaintDefault Paint

PaintDefault is default style can be used when property specifies "default"

func NewPaint Uses

func NewPaint() Paint

func (*Paint) AsMask Uses

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 Uses

func (pc *Paint) BoundingBox(rs *RenderState, minX, minY, maxX, maxY float32) image.Rectangle

BoundingBox computes the bounding box for an element in pixel int coordinates, applying current transform

func (*Paint) BoundingBoxFromPoints Uses

func (pc *Paint) BoundingBoxFromPoints(rs *RenderState, points []Vec2D) image.Rectangle

BoundingBoxFromPoints computes the bounding box for a slice of points

func (*Paint) Clear Uses

func (pc *Paint) Clear(rs *RenderState)

Clear fills the entire image with the current fill color.

func (*Paint) ClearPath Uses

func (pc *Paint) ClearPath(rs *RenderState)

ClearPath clears the current path. There is no current point after this operation.

func (*Paint) Clip Uses

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 Uses

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 Uses

func (pc *Paint) ClosePath(rs *RenderState)

ClosePath adds a line segment from the current point to the beginning of the current subpath. If there is no current point, this is a no-op.

func (*Paint) CopyStyleFrom Uses

func (pc *Paint) CopyStyleFrom(cp *Paint)

CopyStyleFrom copies styles from another paint

func (*Paint) CubicTo Uses

func (pc *Paint) CubicTo(rs *RenderState, x1, y1, x2, y2, x3, y3 float32)

CubicTo adds a cubic bezier curve to the current path starting at the current point. If there is no current point, it first performs MoveTo(x1, y1).

func (*Paint) Defaults Uses

func (pc *Paint) Defaults()

func (*Paint) DrawArc Uses

func (pc *Paint) DrawArc(rs *RenderState, x, y, r, angle1, angle2 float32)

func (*Paint) DrawCircle Uses

func (pc *Paint) DrawCircle(rs *RenderState, x, y, r float32)

func (*Paint) DrawEllipse Uses

func (pc *Paint) DrawEllipse(rs *RenderState, x, y, rx, ry float32)

func (*Paint) DrawEllipticalArc Uses

func (pc *Paint) DrawEllipticalArc(rs *RenderState, cx, cy, rx, ry, angle1, angle2 float32)

DrawElllipticalArc draws arc between angle1 and angle2 along an ellipse, using quadratic bezier curves -- centers of ellipse are at cx, cy with radii rx, ry -- see DrawEllipticalArcPath for a version compatible with SVG A/a path drawing, which uses previous position instead of two angles

func (*Paint) DrawEllipticalArcPath Uses

func (pc *Paint) DrawEllipticalArcPath(rs *RenderState, cx, cy, ocx, ocy, pcx, pcy, rx, ry, angle float32, largeArc, sweep bool) (lx, ly float32)

DrawEllipticalArcPath is draws an arc centered at cx,cy with radii rx, ry, through given angle, either via the smaller or larger arc, depending on largeArc -- returns in lx, ly the last points which are then set to the current cx, cy for the path drawer

func (*Paint) DrawImage Uses

func (pc *Paint) DrawImage(rs *RenderState, fmIm image.Image, x, y int)

DrawImage draws the specified image at the specified point.

func (*Paint) DrawImageAnchored Uses

func (pc *Paint) DrawImageAnchored(rs *RenderState, fmIm image.Image, x, y int, ax, ay float32)

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 Uses

func (pc *Paint) DrawLine(rs *RenderState, x1, y1, x2, y2 float32)

func (*Paint) DrawPolygon Uses

func (pc *Paint) DrawPolygon(rs *RenderState, points []Vec2D)

func (*Paint) DrawPolygonPxToDots Uses

func (pc *Paint) DrawPolygonPxToDots(rs *RenderState, points []Vec2D)

func (*Paint) DrawPolyline Uses

func (pc *Paint) DrawPolyline(rs *RenderState, points []Vec2D)

func (*Paint) DrawPolylinePxToDots Uses

func (pc *Paint) DrawPolylinePxToDots(rs *RenderState, points []Vec2D)

func (*Paint) DrawRectangle Uses

func (pc *Paint) DrawRectangle(rs *RenderState, x, y, w, h float32)

func (*Paint) DrawRegularPolygon Uses

func (pc *Paint) DrawRegularPolygon(rs *RenderState, n int, x, y, r, rotation float32)

func (*Paint) DrawRoundedRectangle Uses

func (pc *Paint) DrawRoundedRectangle(rs *RenderState, x, y, w, h, r float32)

func (*Paint) Fill Uses

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 Uses

func (pc *Paint) FillBox(rs *RenderState, pos, size Vec2D, clr *ColorSpec)

FillBox is an optimized fill of a square region with a uniform color if the given color spec is a solid color

func (*Paint) FillBoxColor Uses

func (pc *Paint) FillBoxColor(rs *RenderState, pos, size Vec2D, clr color.Color)

FillBoxColor is an optimized fill of a square region with given uniform color

func (*Paint) FillPreserve Uses

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 Uses

func (pc *Paint) FillStrokeClear(rs *RenderState)

convenience for final draw for shapes when done

func (*Paint) HasFill Uses

func (pc *Paint) HasFill() bool

does the current Paint have an active fill to render?

func (*Paint) HasNoStrokeOrFill Uses

func (pc *Paint) HasNoStrokeOrFill() bool

does the current Paint not have either a stroke or fill? in which case, often we just skip it

func (*Paint) HasStroke Uses

func (pc *Paint) HasStroke() bool

does the current Paint have an active stroke to render?

func (*Paint) Identity Uses

func (pc *Paint) Identity()

Identity resets the current transformation matrix to the identity matrix. This results in no translating, scaling, rotating, or shearing.

func (*Paint) InheritFields Uses

func (pc *Paint) InheritFields(par *Paint)

InheritFields from parent: Manual inheriting of values is much faster than automatic version!

func (*Paint) InvertY Uses

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 Uses

func (pc *Paint) LineTo(rs *RenderState, x, y float32)

LineTo adds a line segment to the current path starting at the current point. If there is no current point, it is equivalent to MoveTo(x, y)

func (*Paint) MoveTo Uses

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 Uses

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 Uses

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 Uses

func (pc *Paint) ResetClip(rs *RenderState)

ResetClip clears the clipping region.

func (*Paint) Rotate Uses

func (pc *Paint) Rotate(angle float32)

Rotate updates the current matrix with a clockwise rotation. Rotation occurs about the origin. Angle is specified in radians.

func (*Paint) RotateAbout Uses

func (pc *Paint) RotateAbout(angle, x, y float32)

RotateAbout updates the current matrix with a clockwise rotation. Rotation occurs about the specified point. Angle is specified in radians.

func (*Paint) Scale Uses

func (pc *Paint) Scale(x, y float32)

Scale updates the current matrix with a scaling factor. Scaling occurs about the origin.

func (*Paint) ScaleAbout Uses

func (pc *Paint) ScaleAbout(sx, sy, x, y float32)

ScaleAbout updates the current matrix with a scaling factor. Scaling occurs about the specified point.

func (*Paint) SetMask Uses

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 Uses

func (pc *Paint) SetPixel(rs *RenderState, x, y int)

SetPixel sets the color of the specified pixel using the current stroke color.

func (*Paint) SetStyleProps Uses

func (pc *Paint) SetStyleProps(par *Paint, props ki.Props)

SetStyleProps sets paint values based on given property map (name: value pairs), inheriting elements as appropriate from parent, and also having a default style for the "initial" setting

func (*Paint) SetUnitContext Uses

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 Uses

func (pc *Paint) Shear(x, y float32)

Shear updates the current matrix with a shearing angle. Shearing occurs about the origin.

func (*Paint) ShearAbout Uses

func (pc *Paint) ShearAbout(sx, sy, x, y float32)

ShearAbout updates the current matrix with a shearing angle. Shearing occurs about the specified point.

func (*Paint) Stroke Uses

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 Uses

func (pc *Paint) StrokePreserve(rs *RenderState)

StrokePreserve strokes the current path with the current color, line width, line cap, line join and dash settings. The path is preserved after this operation.

func (*Paint) StrokeWidth Uses

func (pc *Paint) StrokeWidth(rs *RenderState) float32

StrokeWidth obtains the current stoke width subject to transform (or not depending on VecEffNonScalingStroke)

func (*Paint) ToDots Uses

func (pc *Paint) ToDots()

ToDots calls ToDots on all units.Value fields in the style (recursively) -- need to have set the UnContext first

func (*Paint) TransformPoint Uses

func (pc *Paint) TransformPoint(rs *RenderState, x, y float32) Vec2D

TransformPoint multiplies the specified point by the current transform matrix, returning a transformed position.

func (*Paint) Translate Uses

func (pc *Paint) Translate(x, y float32)

Translate updates the current matrix with a translation.

type Painter Uses

type Painter interface {
    Paint() *Paint
}

Painter defines an interface for anything that has a Paint on it

type ParamPrefs Uses

type ParamPrefs struct {
    DoubleClickMSec int  `min:"100" step:"50" desc:"the maximum time interval in msec between button press events to count as a double-click"`
    ScrollWheelRate int  `min:"1" step:"1" desc:"how fast the scroll wheel moves -- typically pixels per wheel step -- only used for OS's that do not have a native preference for this (e.g., X11)"`
    LocalMainMenu   bool `desc:"controls whether the main menu is displayed locally at top of each window, in addition to global menu at the top of the screen.  Mac native apps do not do this, but OTOH it makes things more consistent with other platforms, and with larger screens, it can be convenient to have access to all the menu items right there."`
}

ParamPrefs contains misc parameters controlling GUI behavior.

func (*ParamPrefs) Defaults Uses

func (pf *ParamPrefs) Defaults()

type PartsWidgetBase Uses

type PartsWidgetBase struct {
    WidgetBase
    Parts Layout `json:"-" xml:"-" view-closed:"true" desc:"a separate tree of sub-widgets that implement discrete parts of a widget -- positions are always relative to the parent widget -- fully managed by the widget and not saved"`
}

PartsWidgetBase is the base type for all Widget Node2D elements that manage a set of constitutent parts

func (*PartsWidgetBase) ComputeBBox2D Uses

func (wb *PartsWidgetBase) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)

func (*PartsWidgetBase) ComputeBBox2DParts Uses

func (wb *PartsWidgetBase) ComputeBBox2DParts(parBBox image.Rectangle, delta image.Point)

func (*PartsWidgetBase) ConfigPartsIconLabel Uses

func (wb *PartsWidgetBase) ConfigPartsIconLabel(icnm string, 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 (*PartsWidgetBase) ConfigPartsSetIconLabel Uses

func (wb *PartsWidgetBase) ConfigPartsSetIconLabel(icnm string, txt string, icIdx, lbIdx int)

ConfigPartsSetIconLabel sets the icon and text values in parts, and get part style props, using given props if not set in object props

func (*PartsWidgetBase) Layout2D Uses

func (wb *PartsWidgetBase) Layout2D(parBBox image.Rectangle, iter int) bool

func (*PartsWidgetBase) Layout2DParts Uses

func (wb *PartsWidgetBase) Layout2DParts(parBBox image.Rectangle, iter int)

func (*PartsWidgetBase) Move2D Uses

func (wb *PartsWidgetBase) Move2D(delta image.Point, parBBox image.Rectangle)

func (*PartsWidgetBase) PartsNeedUpdateIconLabel Uses

func (wb *PartsWidgetBase) PartsNeedUpdateIconLabel(icnm string, txt string) bool

PartsNeedUpdateIconLabel check if parts need to be updated -- for ConfigPartsIfNeeded

func (*PartsWidgetBase) Render2DParts Uses

func (wb *PartsWidgetBase) Render2DParts()

func (*PartsWidgetBase) SetFullReRenderIconLabel Uses

func (wb *PartsWidgetBase) SetFullReRenderIconLabel()

SetFullReRenderIconLabel sets the icon and label to be re-rendered, needed when styles change

func (*PartsWidgetBase) Size2D Uses

func (wb *PartsWidgetBase) Size2D(iter int)

func (*PartsWidgetBase) Size2DParts Uses

func (wb *PartsWidgetBase) Size2DParts(iter int)

func (*PartsWidgetBase) SizeFromParts Uses

func (wb *PartsWidgetBase) SizeFromParts(iter int)

SizeFromParts sets our size from those of our parts -- default..

type Preferences Uses

type Preferences struct {
    LogicalDPIScale float32                `min:"0.1" step:"0.1" desc:"overall scaling factor for Logical DPI as a multiplier on Physical DPI -- smaller numbers produce smaller font sizes etc"`
    ScreenPrefs     map[string]ScreenPrefs `desc:"screen-specific preferences -- will override overall defaults if set"`
    Colors          ColorPrefs             `desc:"color preferences"`
    Params          ParamPrefs             `desc:"parameters controlling GUI behavior"`
    KeyMap          KeyMapName             `desc:"select the active keymap from list of available keymaps -- see Edit KeyMaps for editing / saving / loading that list"`
    SaveKeyMaps     bool                   `desc:"if set, the current available set of key maps is saved to your preferences directory, and automatically loaded at startup -- this should be set if you are using custom key maps, but it may be safer to keep it <i>OFF</i> if you are <i>not</i> using custom key maps, so that you'll always have the latest compiled-in standard key maps with all the current key functions bound to standard key chords"`
    PrefsOverride   bool                   `desc:"if true my custom style preferences override other styling -- otherwise they provide defaults that can be overriden by app-specific styling"`
    CustomStyles    ki.Props               `desc:"a custom style sheet -- add a separate Props entry for each type of object, e.g., button, or class using .classname, or specific named element using #name -- all are case insensitive"`
    FontFamily      FontName               `desc:"default font family when otherwise not specified"`
    FontPaths       []string               `desc:"extra font paths, beyond system defaults -- searched first"`
    User            User                   `desc:"user info -- partially filled-out automatically if empty / when prefs first created"`
    FavPaths        FavPaths               `desc:"favorite paths, shown in FileViewer and also editable there"`
    SavedPathsMax   int                    `desc:"maximum number of saved paths to save in FileView"`
    FileViewSort    string                 `view:"-" desc:"column to sort by in FileView, and :up or :down for direction -- updated automatically via FileView"`
    ColorFilename   FileName               `view:"-" ext:".json" desc:"filename for saving / loading colors"`
    Changed         bool                   `view:"-" changeflag:"+" json:"-" xml:"-" desc:"flag that is set by StructView by virtue of changeflag tag, whenever an edit is made.  Used to drive save menus etc."`
}

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 Uses

func (pf *Preferences) Apply()

Apply preferences to all the relevant settings.

func (*Preferences) ApplyDPI Uses

func (pf *Preferences) ApplyDPI()

ApplyDPI updates the screen LogicalDPI values according to current preferences and zoom factor, and then updates all open windows as well.

func (*Preferences) Defaults Uses

func (pf *Preferences) Defaults()

func (*Preferences) DeleteSavedWindowGeoms Uses

func (pf *Preferences) DeleteSavedWindowGeoms()

DeleteSavedWindowGeoms deletes the file that saves the position and size of each window, by screen, and clear current in-memory cache. You shouldn't need to use this but sometimes useful for testing.

func (*Preferences) EditKeyMaps Uses

func (pf *Preferences) EditKeyMaps()

EditKeyMaps opens the KeyMapsView editor to create new keymaps / save / load from other files, etc. Current avail keymaps are saved and loaded with preferences automatically.

func (*Preferences) Open Uses

func (pf *Preferences) Open() error

Open preferences from GoGi standard prefs directory

func (*Preferences) OpenColors Uses

func (pf *Preferences) OpenColors(filename FileName) error

OpenColors colors from a JSON-formatted file.

func (*Preferences) Save Uses

func (pf *Preferences) Save() error

Save Preferences to GoGi standard prefs directory

func (*Preferences) SaveColors Uses

func (pf *Preferences) SaveColors(filename FileName) error

Save colors to a JSON-formatted file, for easy sharing of your favorite palettes.

func (*Preferences) SaveZoom Uses

func (pf *Preferences) SaveZoom(forCurrentScreen bool)

SaveZoom saves the current LogicalDPI scaling, either as the overall default or specific to the current screen.

func (*Preferences) ScreenInfo Uses

func (pf *Preferences) ScreenInfo() string

ScreenInfo returns screen info for all screens on the console.

func (*Preferences) Update Uses

func (pf *Preferences) Update()

Update updates all open windows with current preferences -- triggers rebuild of default styles.

func (*Preferences) UpdateUser Uses

func (pf *Preferences) UpdateUser()

UpdateUser gets the user info from the OS

type RGBAf32 Uses

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

func (RGBAf32) RGBA Uses

func (c RGBAf32) RGBA() (r, g, b, a uint32)

Implements the color.Color interface

type Region2D Uses

type Region2D struct {
    Offset mgl32.Vec2
    Size   mgl32.Vec2
}

defines a region in 2D space

type RegionMap2D Uses

type RegionMap2D struct {
    Target  Region2D   `desc:"target region to render into (e.g., in RenderPlane)"`
    Rescale mgl32.Vec2 `desc:"rescaling that we provide for children nodes into the Target Size region -- we present region that is at Offset lower-left corner, of size Size * Rescale size"`
    Size    mgl32.Vec2 `desc:"Our overall size: Target.Size * Rescale"`
}

defines how a region in 2D space is mapped

type RenderState Uses

type RenderState struct {
    Paint          Paint             `desc:"communal painter -- for widgets -- SVG have their own"`
    XForm          Matrix2D          `desc:"current transform"`
    Path           rasterx.Path      `desc:"current path"`
    Raster         *rasterx.Dasher   `desc:"rasterizer -- stroke / fill rendering engine from rasterx"`
    Scanner        *scanFT.ScannerFT `desc:"scanner for freetype-based rasterx"`
    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   `desc:"boundaries to restrict drawing to -- much faster than clip mask for basic square region exclusion -- used for restricting drawing"`
    LastRenderBBox image.Rectangle   `desc:"bounding box of last object rendered -- computed by renderer during Fill or Stroke, grabbed by SVG objects"`
    XFormStack     []Matrix2D        `desc:"stack of transforms"`
    BoundsStack    []image.Rectangle `desc:"stack of bounds -- every render starts with a push onto this stack, and finishes with a pop"`
    ClipStack      []*image.Alpha    `desc:"stack of clips, if needed"`
    PaintBack      Paint             `desc:"backup of paint -- don't need a full stack but sometimes safer to backup and restore"`
    RasterMu       sync.Mutex        `desc:"mutex for final rasterx rendering -- only one at a time"`
}

The RenderState holds all the current rendering state information used while painting -- a viewport just has one of these

func (*RenderState) BackupPaint Uses

func (rs *RenderState) BackupPaint()

BackupPaint copies style settings from Paint to PaintBack

func (*RenderState) Init Uses

func (rs *RenderState) Init(width, height int, img *image.RGBA)

Init initializes RenderState -- must be called whenever image size changes

func (*RenderState) PopBounds Uses

func (rs *RenderState) PopBounds()

PopBounds pops bounds off the stack and set to current bounds

func (*RenderState) PopClip Uses

func (rs *RenderState) PopClip()

PopClip pops Mask off the clip stack and set to current mask

func (*RenderState) PopXForm Uses

func (rs *RenderState) PopXForm()

PopXForm pops xform off the stack and set to current xform

func (*RenderState) PushBounds Uses

func (rs *RenderState) PushBounds(b image.Rectangle)

PushBounds pushes current bounds onto stack and set new bounds

func (*RenderState) PushClip Uses

func (rs *RenderState) PushClip()

PushClip pushes current Mask onto the clip stack

func (*RenderState) PushXForm Uses

func (rs *RenderState) PushXForm(xf Matrix2D)

PushXForm pushes current xform onto stack and apply new xform on top of it

func (*RenderState) RestorePaint Uses

func (rs *RenderState) RestorePaint()

RestorePaint restores style settings from PaintBack to Paint

type RowCol Uses

type RowCol int32

row / col for grid data

const (
    Row RowCol = iota
    Col
    RowColN
)

func (*RowCol) FromString Uses

func (i *RowCol) FromString(s string) error

func (RowCol) MarshalJSON Uses

func (ev RowCol) MarshalJSON() ([]byte, error)

func (RowCol) String Uses

func (i RowCol) String() string

func (*RowCol) UnmarshalJSON Uses

func (ev *RowCol) UnmarshalJSON(b []byte) error

type RuneRender Uses

type RuneRender struct {
    Face    font.Face       `json:"-" xml:"-" desc:"fully-specified font rendering info, includes fully computed font size -- this is exactly what will be drawn -- no further transforms"`
    Color   color.Color     `json:"-" xml:"-" desc:"color to draw characters in"`
    BgColor color.Color     `json:"-" xml:"-" desc:"background color to fill background of color -- for highlighting, <mark> tag, etc -- unlike Face, Color, this must be non-nil for every case that uses it, as nil is also used for default transparent background"`
    Deco    TextDecorations `desc:"additional decoration to apply -- underline, strike-through, etc -- also used for encoding a few special layout hints to pass info from styling tags to separate layout algorithms (e.g., &lt;P&gt; vs &lt;BR&gt;)"`
    RelPos  Vec2D           `desc:"relative position from start of TextRender for the lower-left baseline rendering position of the font character"`
    Size    Vec2D           `desc:"size of the rune itself, exclusive of spacing that might surround it"`
    RotRad  float32         `desc:"rotation in radians for this character, relative to its lower-left baseline rendering position"`
    ScaleX  float32         `desc:"scaling of the X dimension, in case of non-uniform scaling, 0 = no separate scaling"`
}

RuneRender contains fully explicit data needed for rendering a single rune -- Face and Color can be nil after first element, in which case the last non-nil is used -- likely slightly more efficient to avoid setting all those pointers -- float32 values used to support better accuracy when transforming points

func (*RuneRender) CurColor Uses

func (rr *RuneRender) CurColor(curColor color.Color) color.Color

CurColor is convenience for updating current color if non-nil

func (*RuneRender) CurFace Uses

func (rr *RuneRender) CurFace(curFace font.Face) font.Face

CurFace is convenience for updating current font face if non-nil

func (*RuneRender) HasNil Uses

func (rr *RuneRender) HasNil() error

HasNil returns error if any of the key info (face, color) is nil -- only the first element must be non-nil

func (*RuneRender) RelPosAfterLR Uses

func (rr *RuneRender) RelPosAfterLR() float32

RelPosAfterLR returns the relative position after given rune for LR order: RelPos.X + Size.X

func (*RuneRender) RelPosAfterRL Uses

func (rr *RuneRender) RelPosAfterRL() float32

RelPosAfterRL returns the relative position after given rune for RL order: RelPos.X - Size.X

func (*RuneRender) RelPosAfterTB Uses

func (rr *RuneRender) RelPosAfterTB() float32

RelPosAfterTB returns the relative position after given rune for TB order: RelPos.Y + Size.Y

type ScreenPrefs Uses

type ScreenPrefs struct {
    LogicalDPIScale float32 `min:"0.1" step:"0.1" desc:"overall scaling factor for Logical DPI as a multiplier on Physical DPI -- smaller numbers produce smaller font sizes etc.  Actual Logical DPI is enforced to be a multiple of 6, so the precise number here isn't critical -- rounding to 2 digits is more than sufficient."`
}

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 Uses

type ScrollBar struct {
    SliderBase
}

ScrollBar has a proportional thumb size reflecting amount of content visible

func (*ScrollBar) ConnectEvents2D Uses

func (sb *ScrollBar) ConnectEvents2D()

func (*ScrollBar) Defaults Uses

func (sb *ScrollBar) Defaults()

func (*ScrollBar) FocusChanged2D Uses

func (sb *ScrollBar) FocusChanged2D(change FocusChanges)

func (*ScrollBar) Init2D Uses

func (sb *ScrollBar) Init2D()

func (*ScrollBar) Layout2D Uses

func (sb *ScrollBar) Layout2D(parBBox image.Rectangle, iter int) bool

func (*ScrollBar) Move2D Uses

func (sb *ScrollBar) Move2D(delta image.Point, parBBox image.Rectangle)

func (*ScrollBar) Render2D Uses

func (sb *ScrollBar) Render2D()

func (*ScrollBar) Render2DDefaultStyle Uses

func (sb *ScrollBar) Render2DDefaultStyle()

render using a default style if not otherwise styled

func (*ScrollBar) Size2D Uses

func (sb *ScrollBar) Size2D(iter int<