Procházet zdrojové kódy

Add version number and documentation

menus
Noah Petherbridge před 1 rokem
rodič
revize
fb9127f0d5
4 změnil soubory, kde provedl 45 přidání a 5 odebrání
  1. +10
    -0
      docs.go
  2. +1
    -5
      go.mod
  3. +30
    -0
      tooltip_test.go
  4. +4
    -0
      version.go

+ 10
- 0
docs.go Zobrazit soubor

@@ -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

+ 1
- 5
go.mod Zobrazit soubor

@@ -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
- 0
tooltip_test.go Zobrazit soubor

@@ -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
- 0
version.go Zobrazit soubor

@@ -0,0 +1,4 @@
package ui

// Version of the UI toolkit.
const Version = "0.1.0"

Načítá se…
Zrušit
Uložit