-
Notifications
You must be signed in to change notification settings - Fork 7
/
window.go
43 lines (36 loc) · 901 Bytes
/
window.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// This is free and unencumbered software released into the public
// domain. For more information, see <http://unlicense.org> or the
// accompanying UNLICENSE file.
package main
import (
"bytes"
"fmt"
"image"
"github.com/nelsam/gxui"
"github.com/nelsam/vidar/asset"
)
// icon returns the image.Image to be used as vidar's icon.
func icon() image.Image {
r := bytes.NewReader(asset.MustAsset("icon.png"))
i, _, err := image.Decode(r)
if err != nil {
panic(fmt.Errorf("could not decode png: %s", err))
}
return i
}
// window is a slightly modified gxui.Window that we use to wrap up
// some child types.
type window struct {
gxui.Window
child interface{}
}
func newWindow(t gxui.Theme) *window {
w := &window{
Window: t.CreateWindow(1600, 800, "Vidar Text Editor"),
}
w.SetIcon(icon())
return w
}
func (w *window) Elements() []interface{} {
return []interface{}{w.child}
}