Skip to content

Code Map

Randall C. O'Reilly edited this page Jan 25, 2024 · 1 revision

This is an overview of where stuff is within the repository.

  • examples/widgets -- main example widget gallery -- go get ... go build in there to give it a try -- see README there for more info. Many other demos / tests in examples/*.
  • node*.go -- NodeBase, Node2DBase, 3D structs and interfaces -- all Gi nodes are of this type.
  • geom2d.go -- Vec2D is main geom type used for 2D, plus transform Matrix2D.
  • paint.go -- Paint struct that does all the direct rendering, uses gg-based API but now uses the srwiley/renderx rendering system which supports SVG 2.0, and is very fast.
    • stroke.go, fill.go -- StrokeStyle and FillStyle structs for stroke, fill settings
    • color.go -- ColorSpec for full gradient support, Color is basic color.Color compatibale RGBA type with many additional useful methods, including support for HSL colorspace -- see Wiki Color for more info.
  • style.go -- Style and associated structs for CSS-based Widget styling.
  • viewport2d.go -- Viewport2D that has an Image.RGBA that Paint renders onto.
  • window.go -- Window is the top-level window that manages an OS-specific oswin.Window and handles the event loop.
  • font.go, text.go -- FontStyle, TextStyle, and TextRender that manages rich-text rendering in a powerful, efficient manner (layered on RuneRender and SpanRender). FontStyle contains the global color, background-color, and opacity values, to make these easily avail to the TextRender logic.
  • layout.go -- main Layout object with various ways of arranging widget elements, and Frame which does layout and renders a surrounding frame.
  • widget.go -- WidgetBase for all widgets.
  • buttons.go -- ButtonBase, Button and other basic button types.
  • action.go -- Action is a Button-type used in menus and toolbars, with a simplified ActionSig signal.
  • bars.go -- MenuBar and ToolBar
  • sliders.go -- SliderBase, Slider, ScrollBar.
  • textfield.go for TextField, label.go for Label, etc -- also defines the gi.Labeler interface and ToLabel converter method (which falls back on kit.ToString using Stringer), which is used for generating a gui-appropriate label for an object -- e.g., for reflect.Type it just presents the raw type name without prefix.
  • icon.go for Icon wrapper around svg icons (in svg sub-package)
  • Sub-packages:
    • svg -- has all the SVG nodes (Path, Rect etc) plus io.go parser
    • giv -- has all the *View elements
    • gimain -- provides a meta-package wrapper to simplify imports for main apps -- also does relevant final platform-specific customization
    • units -- CSS unit representation
Clone this wiki locally