瀏覽代碼

Add version number and documentation

menus
父節點
當前提交
fb9127f0d5
  1. 10
      docs.go
  2. 6
      go.mod
  3. 30
      tooltip_test.go
  4. 4
      version.go

10
docs.go

@ -0,0 +1,10 @@
/*
Package ui provides a user interface toolkit for Go.
The UI toolkit targets SDL2 applications on desktop (Linux, Mac and Windows)
or an HTML Canvas render engine for web browsers.
It provides various widgets such as Frame, Label, Button, Checkbox, Radiobox
and Tooltip and an event supervisor to monitor the state of the widgets.
*/
package ui

6
go.mod

@ -2,8 +2,4 @@ module git.kirsle.net/go/ui
go 1.13
require (
git.kirsle.net/go/render v0.0.0-20200102014411-4d008b5c468d
github.com/veandco/go-sdl2 v0.4.1 // indirect
golang.org/x/image v0.0.0-20200119044424-58c23975cae1 // indirect
)
require git.kirsle.net/go/render v0.0.0-20200102014411-4d008b5c468d

30
tooltip_test.go

@ -0,0 +1,30 @@
package ui_test
import "git.kirsle.net/go/ui"
// Tooltip usage example.
func ExampleTooltip() {
mw, err := ui.NewMainWindow("Tooltip Example", 800, 600)
if err != nil {
panic(err)
}
// Add a widget that will have a tooltip attached, i.e. a button.
btn := ui.NewButton("My Button", ui.NewLabel(ui.Label{
Text: "Hello world!",
}))
mw.Place(btn, ui.Place{
Center: true,
Middle: true,
})
// Add a tooltip to it. The tooltip attaches itself to the button's
// MouseOver, MouseOut, Compute and Present handlers -- you don't need to
// place the tooltip inside the window or parent frame.
ui.NewTooltip(btn, ui.Tooltip{
Text: "This is a tooltip that pops up\non mouse hover!",
Edge: ui.Right,
})
mw.MainLoop()
}

4
version.go

@ -0,0 +1,4 @@
package ui
// Version of the UI toolkit.
const Version = "0.1.0"
載入中…
取消
儲存