Documentation ¶
Overview ¶
Package icons provides a widget that displays a single icon from the Material Design Icons set. The size of the icon is fixed at 32x32 pixels.
To display an icon, the code-point needs to be determined. This information is available, but buried. The icon names and glyphs can be viewed at the material icons library site (https://www.google.com/design/icons/). To find the code-point, there is an index in the git repository (https://github.com/google/material-design-icons/blob/master/iconfont/codepoints).
License: The original icon files are distributed under the Apache License 2.0.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrRuneNotAvailable = errors.New("rune not available")
)
Functions ¶
Types ¶
type Icon ¶
type Icon rune
Icon describes a widget that shows an icon as an image.
Example ¶
package main import ( "fmt" "time" "bitbucket.org/rj/goey" "bitbucket.org/rj/goey/base" "bitbucket.org/rj/goey/loop" ) const Build = rune(0xe869) const Brightness1 = rune(0xe3a6) const Brightness7 = rune(0xe3ac) func main() { render := func(r rune) base.Widget { return &goey.Padding{ Insets: goey.DefaultInsets(), Child: &goey.Align{ Child: Icon(r), }, } } createWindow := func() error { // Add the controls window, err := goey.NewWindow("Icons", render(Build)) if err != nil { return err } go func() { for i := Brightness1; i <= Brightness7; i++ { time.Sleep(1 * time.Second) err := loop.Do(func() error { return window.SetChild(render(i)) }) if err != nil { panic(err) } } time.Sleep(1 * time.Second) err := loop.Do(func() error { window.Close() return nil }) if err != nil { panic(err) } }() return nil } err := loop.Run(createWindow) if err != nil { fmt.Println("Error: ", err) } fmt.Println("OK") }
Output: OK
Click to show internal directories.
Click to hide internal directories.