Documentation
¶
Overview ¶
Package goui provides a cross platform GUI solution for Go developers.
It uses Cocoa/WebKit for macOS, MSHTML for Windows and Gtk/WebKit for Linux.
It provides two way bindings between Go and Javascript.
Index ¶
- Variables
- func ActivateWindow()
- func BoolToCInt(b bool) (i C.int)
- func Create(settings Settings) (err error)
- func CreateWithMenu(settings Settings, menuDefs []MenuDef) (err error)
- func Log(args ...interface{})
- func Logf(format string, args ...interface{})
- func OpenDevTools()
- func RegisterWidgets(widgets ...Widget)
- func RequestJSService(options JSServiceOptions) (err error)
- func RequestJSServiceFromBackground(options JSServiceOptions) (err error)
- func Service(url string, handler func(*Context))
- func Storage() *storage
- type Context
- func (ctx *Context) Error(err interface{})
- func (ctx *Context) Fail()
- func (ctx *Context) GetBoolParam(name string) (b bool, err error)
- func (ctx *Context) GetEntity(v interface{}) (err error)
- func (ctx *Context) GetFloatParam(name string) (f float64, err error)
- func (ctx *Context) GetIntParam(name string) (i int, err error)
- func (ctx *Context) GetIntParamOr(name string, defaultVal int) (i int)
- func (ctx *Context) GetParam(name string) (val string)
- func (ctx *Context) Ok()
- func (ctx *Context) Success(feedback interface{})
- type JSServiceOptions
- type MenuDef
- type MenuType
- type Request
- type Settings
- type Widget
Constants ¶
This section is empty.
Variables ¶
var Config = initConfig()
var Platform string
Platform is for packager to inject for different platforms
Functions ¶
func ActivateWindow ¶
func ActivateWindow()
func BoolToCInt ¶
func CreateWithMenu ¶
func OpenDevTools ¶
func OpenDevTools()
InvokeJavascriptFunc is for the backend to invoke frontend javascript directly. params:
name - javascript function name params - the parameters
func InvokeJavascriptFunc(name string, params ...interface{}) { js := fiputil.MkString(params,name + "(",",",")") worker.invokeJS(js) }
func RegisterWidgets ¶
func RegisterWidgets(widgets ...Widget)
func RequestJSService ¶
func RequestJSService(options JSServiceOptions) (err error)
RequestJSService is to send a request to the front end from the main thread
func RequestJSServiceFromBackground ¶
func RequestJSServiceFromBackground(options JSServiceOptions) (err error)
RequestJSServiceFromBackground is to send a request to the front end from a background thread
Types ¶
type Context ¶
type Context struct { Data string `json:"data"` SuccessCallback string `json:"success"` ErrorCallback string `json:"error"` // contains filtered or unexported fields }
func (*Context) GetBoolParam ¶
GetBoolParam get a bool parameter from the url
func (*Context) GetFloatParam ¶
GetFloatParam get a float parameter from the url
func (*Context) GetIntParam ¶
GetIntParam get a int parameter from the url
func (*Context) GetIntParamOr ¶
type JSServiceOptions ¶
type MenuDef ¶
type MenuDef struct { Type MenuType Title string HotKey string Action string Handler func() Children []MenuDef }
MenuDef is to define a menu item
type Settings ¶
type Settings struct { Title string //Title of the application window UIDir string //Directory of the UI/Web related files, default: "ui" Index string //Index html file, default: "index.html" Url string //Full url address if you don't use WebDir + Index Left int Top int Width int Height int Resizable bool Debug bool }
Settings is to configure the window's appearance