4 changed files with 45 additions and 5 deletions
@ -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 |
@ -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() |
|||
} |
@ -0,0 +1,4 @@ |
|||
package ui |
|||
|
|||
// Version of the UI toolkit.
|
|||
const Version = "0.1.0" |
Loading…
Reference in new issue