microgui

package module
v0.0.0-...-becfc0f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

README

microgui

A simple GUI in Go that can be used standalone or in a web page

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(widget Widget)

Add a widget to the UI

func OpenWindow

func OpenWindow(w, h int, title string)

OpenWindow opens the main window

Types

type Button

type Button struct {
	// contains filtered or unexported fields
}

Button is a clickable area with a label.

func NewButton

func NewButton(label string, x, y, w, h int, handler func()) *Button

NewButton creates a new button and returns the pointer

type Label

type Label struct {
	// contains filtered or unexported fields
}

Label is just non-interactive text

func NewLabel

func NewLabel(label string, x, y, w, h int) *Label

NewLabel creates a new Label

func (*Label) SetLabel

func (l *Label) SetLabel(s string)

SetLabel asynchronously sets the label

type Menu struct {
	// contains filtered or unexported fields
}

Menu is a collection of buttons

func NewMenu

func NewMenu(x, y, w, h int, handler func(string), options ...string) *Menu

NewMenu creates a new Menu

type Slider

type Slider struct {
	// contains filtered or unexported fields
}

Slider shows is a control that can be dragged from left to right. The value ranges from 0 to 100.

func NewSlider

func NewSlider(x, y, w, h int, handler func(int)) *Slider

NewSlider creates a new slider.

type TextBox

type TextBox struct {
	// contains filtered or unexported fields
}

TextBox is a multiline Label. It will word-wrap the given content. The conent will never cross the boundaries of the TextBox, and will be truncated if longer.

func NewTextBox

func NewTextBox(text string, x, y, w, h int) *TextBox

NewTextBox creates a new TextBox

func (*TextBox) SetHeight

func (t *TextBox) SetHeight(h int)

SetHeight asynchronously sets the height of the TextBox

func (*TextBox) SetText

func (t *TextBox) SetText(s string)

SetText asynchronously sets the text

func (*TextBox) SetWidth

func (t *TextBox) SetWidth(w int)

SetWidth asynchronously sets the width of the TextBox

type TextField

type TextField struct {
	// contains filtered or unexported fields
}

TextField displays a string and lets the user modify it

func NewTextField

func NewTextField(content string, x, y, w, h int) *TextField

NewTextField creates a text field

func (*TextField) SetContent

func (t *TextField) SetContent(s string)

SetContent asynchronously sets the content of the text field

type Widget

type Widget interface {
	// contains filtered or unexported methods
}

Widget is anyhing that can be added to the UI

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL