Native Go (golang) Graphical Interface system (2D and 3D), built on GoKi tree framework
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bench major speedup by doing manual, simple copy of inherited styled fields Aug 18, 2018
complete Move sorting of candidate completions into the MatchSeed functions so Sep 20, 2018
examples added Ok, Cancel to giv DlgOpts so you can add buttons to any View di… Sep 23, 2018
gimain fix linux, windows gimains Sep 13, 2018
giv consolidated all file stuff in giv/fileinfo -- using this is FileNode… Sep 24, 2018
icons significant fixes to tabview: didn't have proper rebuild around addin… Sep 17, 2018
logo WinWait waitgroup for case where all windows run as GoStart. updated … Sep 4, 2018
oswin mac app updated to latest golang/mobile which redefined TexImage2D me… Sep 20, 2018
svg limit inline views to max sizes; fix key icon typo / crash; dialog pr… Sep 15, 2018
units major fix for units: Em, etc were ALREADY in raw dots -- was double-c… Sep 11, 2018
.gitignore very raw first pass on textedit -- uses chroma to do syntax highlight… Aug 28, 2018
LICENSE add licence, gitignore May 4, 2018
Makefile added basic Makefiles, favorite paths in prefs, FileView -- crashing Jul 28, 2018
README.md textview region box highlight rendering fixed, and stacked layout neg… Sep 23, 2018
action.go change KeyFunSelectItem -> KeyFunEnter -- much clearer about what it … Sep 21, 2018
align_string.go fixed everything with style optimization -- huge savings -- now only … Apr 23, 2018
bars.go major cleanup of events processing methods -- use ConnectEvents2D so … Sep 9, 2018
baselineshifts_string.go new text render initially working -- many issues still Jul 2, 2018
bitmap.go renamed Load -> Open -- requires update of goki/ki with same rename Sep 3, 2018
borderdrawstyle_string.go fixed everything with style optimization -- huge savings -- now only … Apr 23, 2018
boxsides_string.go fixed everything with style optimization -- huge savings -- now only … Apr 23, 2018
buttons.go change KeyFunSelectItem -> KeyFunEnter -- much clearer about what it … Sep 21, 2018
buttonsignals_string.go fixed everything with style optimization -- huge savings -- now only … Apr 23, 2018
buttonstates_string.go style inherits and initial working, treeview inherits background colo… Apr 29, 2018
color.go select working much better Sep 1, 2018
colorparse.go move back to srwiley/rasterx, fix tableview header scroll issue, work… Aug 15, 2018
colorsources_string.go start on ColorSpec and color gradients -- building but not working Jun 16, 2018
combobox.go fixed combobox rendering -- must only re-render label and icon; Style… Sep 10, 2018
complete.go This commit message applies to the last commit as well as this one! Sep 24, 2018
completesignals_string.go insta drag on splitters -- finally fully effortless splitters Sep 6, 2018
css.go major progress on parsing and rendering SVG icons -- testing on KDE s… Jun 23, 2018
dialogs.go limit inline views to max sizes; fix key icon typo / crash; dialog pr… Sep 15, 2018
dialogstate_string.go fixed everything with style optimization -- huge savings -- now only … Apr 23, 2018
dims2d_string.go fixed everything with style optimization -- huge savings -- now only … Apr 23, 2018
doc.go MasterVLay and MainWidget / MainMenu infrastructure for Window; added… Aug 6, 2018
eventpris_string.go added LowRawPri, double-click works, tableview working really well no… Aug 4, 2018
fill.go major code reorganization: moved svg into sub-package -- required som… Jul 26, 2018
fillrule_string.go fixed everything with style optimization -- huge savings -- now only … Apr 23, 2018
focuschanges_string.go focus active / inactive from clicking outside focused widget -- does … Aug 25, 2018
font.go major fix for units: Em, etc were ALREADY in raw dots -- was double-c… Sep 11, 2018
font_test.go fonts all good -- robust fallbacks etc Aug 18, 2018
fontstretch_string.go major font cleanup -- much more systematic and robust -- needs more t… Aug 18, 2018
fontstyles_string.go fixed everything with style optimization -- huge savings -- now only … Apr 23, 2018
fontvariants_string.go new text render initially working -- many issues still Jul 2, 2018
fontweights_string.go major font cleanup -- much more systematic and robust -- needs more t… Aug 18, 2018
frame.go major cleanup of events processing methods -- use ConnectEvents2D so … Sep 9, 2018
geom2d.go maybe fixed x11's insane window sizing / positioning logic Sep 7, 2018
geom3d.go full rename to goki repository May 2, 2018
icon.go fixed combobox rendering -- must only re-render label and icon; Style… Sep 10, 2018
keyfun.go change KeyFunSelectItem -> KeyFunEnter -- much clearer about what it … Sep 21, 2018
keyfuns_string.go change KeyFunSelectItem -> KeyFunEnter -- much clearer about what it … Sep 21, 2018
label.go TextLink has widget pointer so can find parent widgets.. Sep 21, 2018
labelstates_string.go added ContextMenu support in Node2D, general framework for extensible… Jul 31, 2018
layout.go textview region box highlight rendering fixed, and stacked layout neg… Sep 23, 2018
layouts_string.go MasterVLay and MainWidget / MainMenu infrastructure for Window; added… Aug 6, 2018
linecap_string.go support full set of caps and joins from rasterx May 29, 2018
linejoin_string.go support full set of caps and joins from rasterx May 29, 2018
menus.go crash fixes in textview, close in textbuf, marshal of FileTime, etc Sep 20, 2018
node.go fixed icons not rendering when scrolling -- rerendertree needs to sta… Sep 10, 2018
node2d.go significant fixes to tabview: didn't have proper rebuild around addin… Sep 17, 2018
nodeflags_string.go oswin window setgeom, setitle; gi.window setname, settitle, robustnes… Sep 7, 2018
overflow_string.go fixed everything with style optimization -- huge savings -- now only … Apr 23, 2018
paint.go lots of minor crash protects, bug fixes etc -- also added blinking cu… Aug 27, 2018
prefs.go added user info to prefs, fixed misc crashes in table / slice view an… Sep 18, 2018
rowcol_string.go fixed everything with style optimization -- huge savings -- now only … Apr 23, 2018
screenshot.png add screenshot May 4, 2018
sliders.go major fix for units: Em, etc were ALREADY in raw dots -- was double-c… Sep 11, 2018
slidersignals_string.go fixed everything with style optimization -- huge savings -- now only … Apr 23, 2018
sliderstates_string.go style inherits and initial working, treeview inherits background colo… Apr 29, 2018
spinbox.go narrow space in action, button icon -> text, other minor fixes Sep 21, 2018
splitview.go significant fixes to tabview: didn't have proper rebuild around addin… Sep 17, 2018
stripes_string.go row or col stripes option for frame with grid layout -- using in stru… Jun 30, 2018
stroke.go major code reorganization: moved svg into sub-package -- required som… Jul 26, 2018
style.go major fix for units: Em, etc were ALREADY in raw dots -- was double-c… Sep 11, 2018
style_test.go new paradigm for getting decorations to render with rotation etc Jul 6, 2018
tabview.go tabview init more robust Sep 23, 2018
tabviewsignals_string.go added Ok, Cancel to giv DlgOpts so you can add buttons to any View di… Sep 23, 2018
text.go TextLink has widget pointer so can find parent widgets.. Sep 21, 2018
textanchors_string.go new text render initially working -- many issues still Jul 2, 2018
textdecorations_string.go most svg rendering for svn_docs/figs working -- needs markers, use, s… Jul 23, 2018
textdirections_string.go new text render initially working -- many issues still Jul 2, 2018
textfield.go Only destroy completer if not nil Sep 23, 2018
textfieldsignals_string.go select only mode for struct table view -- works great as a selector n… May 26, 2018
textfieldstates_string.go lots of improvements in DND and dragging etc -- start on layout scrol… Jun 8, 2018
unicodebidi_string.go new text render initially working -- many issues still Jul 2, 2018
vectoreffect_string.go new SVG organization now complete, fixed line width to use transform,… Jun 24, 2018
viewport2d.go fixed combobox rendering -- must only re-render label and icon; Style… Sep 10, 2018
views.go major keyfun reorg: key.Chord used for most chords, KeyMaps is a slic… Sep 9, 2018
whitespaces_string.go implemented white-space css property, which also controls word wrap -… Sep 15, 2018
widget.go start / end line in textview now works for wrapped lines. fixed crash… Sep 21, 2018
widgetsignals_string.go added ContextMenu support in Node2D, general framework for extensible… Jul 31, 2018
window.go textview region box highlight rendering fixed, and stacked layout neg… Sep 23, 2018

README.md

gi

alt tag

GoGi is part of the GoKi Go language (golang) full strength tree structure system (ki = tree in Japanese)

package gi is a scenegraph-based 2D and 3D GUI / graphics interface (Gi) in Go

Go Report Card GoDoc

NOTE: Requires Go version 1.10+ due to use of math.Round.

See the Wiki for more docs, discussion, etc.

GoGi uses the GoKi tree infrastructure to implement a simple, elegant GUI framework in full native idiomatic Go (with minimal OS-specific backend interfaces based on the Shiny drivers). The overall design is an attempt to integrate existing standards and conventions from widely-used frameworks, including Qt (overall widget design), HTML / CSS (styling), and SVG (rendering). This 2D framework also integrates with a (planned) 3D scenegraph, supporting interesting combinations of these frameworks. Currently GoGi is focused on desktop systems, but nothing prevents adaptation to mobile.

Main Features

  • Has all the standard widgets: Button, Menu, Slider, TextField, SpinBox, ComboBox etc, with tooltips, hover, focus, copy / paste (full native clipboard support), drag-n-drop -- the full set of standard GUI functionality. See gi/examples/widgets for a demo.

  • Powerful Layout logic auto-sizes everything -- very easy to configure interfaces that just work across different scales, resolutions, platforms. Automatically remembers and reinstates window positions and sizes across sessions.

  • CSS-based styling allows easy customization of everything -- native style properties are fully HTML compatible (with all standard em, px, pct etc units), including full HTML "rich text" styling for all text rendering (e.g., in Label widget) -- can decorate any text with inline tags (<strong>, <em> etc), and even include links.

  • Compiles in second(s), compared to hour(s) for Qt, and is fully native with no cgo dependency on Linux and Windows, and minimal cgo (necessary) on MacOS.

  • Fully self-contained -- does not use OS-specific native widgets -- results in simple, elegant, consistent code across platforms, and is fully HiDPI capable and scalable using standard Shift+Ctrl/Cmd+Plus or Minus key, and in Preferences (press Ctrl+Alt+P in any window to get Prefs editor).

  • SVG element (in svg sub-package) supports full SVG rendering -- used for Icons internally and available for advanced graphics displays -- see gi/examples/svg for viewer and start on editor, along with a number of test .svg files.

  • Advanced Model / View paradigm with reflection-based view elements that display and manipulate all the standard Go types (in giv sub-package), from individual types (e.g., int, float display in a SpinBox, "enum" const int types in a ComboBox chooser) to composite data structures, including StructView editor of struct fields, MapView and SliceView displays of map and slice elements (including full editing / adding / deleting of elements), and full-featured TableView for a slice-of-struct and TreeView for GoKi trees.

    • TreeView enables a built-in GUI editor / inspector for designing gui elements themselves. Just press Control+Alt+I in any window to pull up this editor / inspector. Scene graphs can be automatically saved / loaded from JSON files, to provide a basic GUI designer framework -- just load and add appropriate connections..

Screenshot of Widgets demo

Code Map

  • 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 compatible 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

Code Overview

There are three main types of 2D nodes:

  • Viewport2D nodes that manage their own oswin.Image bitmap and can upload that directly to the oswin.Texture that then uploads directly to the oswin.Window. The parent Window has a master Viewport2D that backs the entire window, and is what most Widget's render into. + Popup Dialog and Menu's have their own viewports that are layered on top of the main window viewport. + SVG and its subclass Icon are containers for SVG-rendering nodes.

  • Widget nodes that use the full CSS-based styling (e.g., the Box model etc), are typically placed within a Layout -- they use units system with arbitrary DPI to transform sizes into actual rendered dots (term for actual raw resolution-dependent pixels -- "pixel" has been effectively co-opted as a 96dpi display-independent unit at this point). Widgets have non-overlapping bounding boxes (BBox -- cached for all relevant reference frames).

  • SVG rendering nodes that directly set properties on the Paint object and typically have their own geometry etc -- they should be within a parent SVG viewport, and their geom units are determined entirely by the transforms etc and we do not support any further unit specification -- just raw float values.

General Widget method conventions:

  • SetValue kinds of methods are wrapped in UpdateStart / End, but do NOT emit a signal
  • SetValueAction calls SetValue and emits the signal This allows other users of the widget that also recv the signal to not trigger themselves, but typically you want the update, so it makes sense to have that in the basic version. ValueView in particular requires this kind of behavior.

The best way to see how the system works are in the examples directory, and by interactively modifying any existing gui using the interactive reflective editor via Control+Alt+E.

Status

Currently at a pre-beta level (DON'T RECOMMEND USING RIGHT NOW -- come back in a few weeks after announcement on go-nuts email list).

  • Major push underway to get to the following target for a beta level release:

  • All major functionality is in place, and API is stable and only very minor changes will be allowed going forward. The system is now ready for wider adoption.

  • Everything has been thoroughly tested, but generally only by a small number of core developers / users.

  • Please file Issues for anything that does not work (except as noted below under TODO)

TODO

  • would be a lot faster if textbuf held the markup text and views just read off of that -- then switching buffers would be instant. might make it easier to protect the updating too -- views don't get a crack at anything until it is updated.. -- also ideally do a diff for re-open, and only re-highlight areas that are changed. as a first pass, at least testing for identity would save a lot of time for most post-save actions.

  • focus issues in tableview: real! but very hard to reproduce!

  • closing a buffer, and more generally sometimes, renders too-narrow box width. init is also too narrow at start actually.

  • also more generally the select logic for resetting the start of select needs to be fixed to work like emacs..

  • fix embedded tags in pre html parser -- just need a simple stack..

  • NOT getting mysterious crashes in clearClip and closewindow on mac in cocoa.m -- once I turned off mainmenu updating -- will try to re-activate and debug..

  • drag on textview should prevent DND -- dnd not getting "processed"

  • TextView:

    • select / space / return on links in inactive mode should activate link, and why is typing working on inactive mode anyway!?
    • word-level functions: forward, back, delete etc. ctrl+ backspace is back.
    • clipboard history
    • clipboard "registers" (C-x x , C-x g )
  • Splitview:

    • gide resize textview not re-drawing (still?)
    • some lowpri keyfuns for collapsing and expanding -- this goes in gide -- need multi-key.
  • CSS class = x should bring in properties for that class into top-level CSS for all below -- not sure it does that - nested classes. need to figure that out really.

  • slice of ki: do proper add so it works directly by editing children -- requires accessing owner info from valueview recs -- that is what the ki.Slice by itself does not have

  • see if ubuntu and windows have a decent unicode fallback font https://unix.stackexchange.com/questions/14027/what-fonts-are-good-for-unicode-glyphs

  • windows: arialuni.ttf https://docs.microsoft.com/en-us/typography/font-list/arial-unicode-ms

  • textfield should scroll layout so that cursor is always in view, when editing..

  • fileview should add extension to filename if only one extension provided, if user types in a new filename..

  • fix text scrolling-off-top rendering finally

  • fix the style-props context -- need an overall prop on objects -- in type presumably. completer needs to know about this too. in mapview proximally.

  • update gi/doc.go with final readme notes etc! add docs to this README about "what can you do with demos?" kind of thing..

  • update widgets README

  • Reminder: grep all todo: in code