README

Logo Olt

A GUI framework built on Gio making GUIs in Go easier than HTML/CSS/JS

GoDoc Go Report Card

This is a repository containing tools and widgets for making programming multi-platform GUIs in pure Go painless and intuitive.

Documentation

Overview

Package olt is a repository containing tools and widgets for making programming multi-platform GUIs in pure Go painless and intuitive.

Most GUI frameworks are burdened with legacy object oriented paradigms, and very different APIs and often complex multi-language systems. This is obstructive to the Go programmer, who wants to just use Go for everything. Go's syntax and features allow the creation of concise ways of calling and referring to variables and this is basically syntactic sugar plus extensible, nice set of primitives for building interfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DP

func DP(i int) unit.Value

DP returns a unit.DP

func HorizontalFlexBox

func HorizontalFlexBox() *layout.Flex

HorizontalFlexBox returns an empty layout.Flex set to horizontal

func NewList

func NewList(scrollToEnd bool) *layout.List

NewList returns a new list layout box

func Rigid

func Rigid(w layout.Widget) (out layout.FlexChild)

Rigid returns a rigid layout box

func VerticalFlexBox

func VerticalFlexBox() *layout.Flex

VerticalFlexBox returns an empty layout.Flex set to vertical

Types

type Box

type Box struct {
	W, H int
	Radius
}

Box is a rectangle that is that simplifies specifying drawing a rectangle

func NewBox

func NewBox(w, h int, r ...Radius) Box

New creates a new Box

func (Box) ClipOp

func (b Box) ClipOp(c *Ctx) clip.Op

ClipOp returns a clip.Rect based on a Box

type Coord

type Coord struct {
	image.Point
}

Coord is a wrapper on image.Point so we can attach local methods to it

func (Coord) New

func (c Coord) New(x, y int) Coord

New creates a new Coord

type Ctx

type Ctx struct {
	*layout.Context
	W *app.Window

	L *logi.Logger
	// contains filtered or unexported fields
}

Ctx is a wrapper around layout.Context and app.Window and embeds an error so its methods can be chained

func New

func New(w ...*app.Window) (c *Ctx)

New returns a new context. This is an initializer, invoke thus:

ctx := olt.Ctx{}.New()

func (*Ctx) ARGB

func (c *Ctx) ARGB(rgba uint32) (col color.RGBA)

ARGB returns a color.ARGB from a uint32, use like this: ARGB(0xAARRGGBB)

func (*Ctx) ClearError

func (c *Ctx) ClearError() *Ctx

ClearError nils the embedded error

func (Ctx) Ctx

func (c Ctx) Ctx() *layout.Context

Ctx returns the underlying layout.Context

func (*Ctx) DrawRectangle

func (c *Ctx) DrawRectangle(color color.RGBA, b Box, inset unit.Value)

DrawRectangle draws a box with a given set of corner radii and a fill colour

func (*Ctx) EmptyFlexBox

func (c *Ctx) EmptyFlexBox(col ...color.RGBA) layout.Widget

EmptyFlexBox is just a box with a given colour

func (*Ctx) EmptyRigid

func (c *Ctx) EmptyRigid(box Box, col ...color.RGBA) layout.Widget

EmptyFlexBox is just a box with a given colour

func (*Ctx) Err

func (c *Ctx) Err() error

Err returns the underlying error variable

func (*Ctx) Error

func (c *Ctx) Error() string

Error implements the Error interface and returns a string

func (*Ctx) GetHFlexed

func (c *Ctx) GetHFlexed(weight float32, children ...layout.FlexChild) layout.FlexChild

GetHFlexed returns a layout.FlexChild in horizontal orientation embedded in a layout.FlexChild

func (*Ctx) GetList

func (c *Ctx) GetList(fn func(i int)) List

GetList returns a simple list composed of a vertical layout.Flex that can scroll up and down

func (*Ctx) GetVFlexed

func (c *Ctx) GetVFlexed(weight float32, children ...layout.FlexChild) layout.FlexChild

GetVFlexed returns a layout.FlexChild in vertical orientation embedded in a layout.FlexChild

func (*Ctx) NewFlexChildren

func (c *Ctx) NewFlexChildren() *FlexChildren

NewFlexChildren creates a new FlexChildren and binds itself to it

func (*Ctx) SetError

func (c *Ctx) SetError(err string) *Ctx

SetError sets the error to a new string and logs it

func (*Ctx) SetErrorLogger

func (c *Ctx) SetErrorLogger(logger func(err string)) *Ctx

SetErrorLogger loads a function that is used to print errors when they are set

func (*Ctx) Seterror

func (c *Ctx) Seterror(err error) *Ctx

Seterror sets the underlying error value directly and logs it if the closure is loaded

func (*Ctx) Window

func (c *Ctx) Window() *Window

type FlexChildren

type FlexChildren struct {
	C      []layout.FlexChild
	Weight float32
	*Ctx
}

FlexChildren is a struct to manage a list of layout.FlexChild(s) and provides a collection of editing functions

func (*FlexChildren) AddHFlex

func (f *FlexChildren) AddHFlex(weight float32, children *FlexChildren)

AddHFlex adds a FlexChildren in horizontal orientation

func (*FlexChildren) AddToEnd

func (f *FlexChildren) AddToEnd(fc layout.FlexChild) *FlexChildren

func (*FlexChildren) AddToStart

func (f *FlexChildren) AddToStart(fc layout.FlexChild) *FlexChildren

func (*FlexChildren) AddVFlex

func (f *FlexChildren) AddVFlex(weight float32, children *FlexChildren)

AddVFlex adds a FlexChildren in vertical orientation

func (*FlexChildren) AddWidgets

func (f *FlexChildren) AddWidgets(weight float32, w ...layout.Widget) *FlexChildren

AddWidgets allows you to add widgets directly to a FlexChildren

func (*FlexChildren) Append

func (f *FlexChildren) Append(a *FlexChildren) *FlexChildren

Append adds more FlexChildren to the end of a FlexChildren and returns it

func (*FlexChildren) Delete

func (f *FlexChildren) Delete(start, end int) *FlexChildren

Delete removes a specified set of elements in a FlexChildren

func (*FlexChildren) FlexChildSlice

func (f *FlexChildren) FlexChildSlice() []layout.FlexChild

FlexChildSlice returns the underlying []layout.FlexChild

func (*FlexChildren) Insert

func (f *FlexChildren) Insert(index int, a *FlexChildren) *FlexChildren

Insert inserts a given FlexChildren inside another FlexChildren and returns it

func (*FlexChildren) InsertAt

func (f *FlexChildren) InsertAt(fc layout.FlexChild, index int) *FlexChildren

func (*FlexChildren) Prepend

func (f *FlexChildren) Prepend(a *FlexChildren) *FlexChildren

Prepend inserts a given FlexChildren before the existing contents and returns it

func (*FlexChildren) RenderHFlex

func (f *FlexChildren) RenderHFlex() *layout.Flex

RenderHFlex returns a horizontal Layout.Flex with its contents inside

func (*FlexChildren) RenderVFlex

func (f *FlexChildren) RenderVFlex() *layout.Flex

RenderVFlex returns a vertical layout.Flex with its contents inside

type LayoutFunc

type LayoutFunc func(c *Ctx)

LayoutFunc is the function signature for a function that creates a new layout.Flex. This is used to create the root widget of a window where all the rest of the render tree is placed

type List

type List struct {
	*Ctx
	Theme *material.Theme
	*layout.List
}

type Radius

type Radius struct {
	SE, SW, NE, NW float32
}

Radius is the corner radii for rounded rectangles. Zero means no rounding.

type Widget

type Widget struct {
	layout.Widget
}

Widget is a wrapper on layout.Widget so we can create local methods on the same type

type Widgeter

type Widgeter interface {
	Draw()
	Dimensions() image.Point
}

Widgeter is an interface that provides automatic access to dimensions information for custom widgets

type Window

type Window struct {
	*Ctx
	*app.Window
	// contains filtered or unexported fields
}

func (*Window) Load

func (w *Window) Load(lf LayoutFunc) *Window

func (*Window) Open

func (w *Window) Open() *Window

func (*Window) Size

func (w *Window) Size(W, H int) *Window

func (*Window) Title

func (w *Window) Title(title string) *Window

Directories

Path Synopsis
examples