experimental package to reduce boilerplate when working with the Gio immediate mode GUI.
Go to file
2019-08-15 09:27:04 -04:00
cmd/hello Refactor into a package. 2019-08-15 09:16:00 -04:00
main.go Add README.md 2019-08-15 09:27:04 -04:00
README.md Add README.md 2019-08-15 09:27:04 -04:00

GIOWrap

An experimental wrapper package for the Gio immediate mode GUI, designed to reduce boilerplate.

The basic concept is to define a Context type that contains the Gio variables required for layout and drawing. Context contains a pointer to app.Window and ui.Ops so that, once layout is complete, you can call Context.Draw() to draw your objects in your window.

The following types and functions are defined in order to transform a Context variable during layout:

type Layout func(Context) Context

type Widget interface {
	Layout(Context) Context
}

func LayoutWithContext(ctx Context, ws ...Widget) Context {
	for _, w := range ws {
		ctx = w.Layout(ctx)
	}
	return ctx
}

type WidgetCombinator func(...Widget) Widget

type Enclosure interface {
	Begin(Context) Context
	End(Context) Context
}

func Enclose(e Enclosure, w ...Widget) Widget { ... }