-
Notifications
You must be signed in to change notification settings - Fork 0
/
errapp.go
64 lines (55 loc) · 2.74 KB
/
errapp.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright 2018 The GoKi Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// based on golang.org/x/exp/shiny:
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package errapp provides a stub App implementation.
package errapp
import (
"image"
"github.com/goki/gi/oswin"
"github.com/goki/gi/oswin/clip"
"github.com/goki/gi/oswin/cursor"
)
// Stub returns an App whose methods all return the given error.
func Stub(err error) oswin.App {
return stub{err}
}
type stub struct {
err error
}
func (s stub) NewImage(size image.Point) (oswin.Image, error) { return nil, s.err }
func (s stub) NewTexture(win oswin.Window, size image.Point) (oswin.Texture, error) {
return nil, s.err
}
func (s stub) NewWindow(opts *oswin.NewWindowOptions) (oswin.Window, error) { return nil, s.err }
func (s stub) NScreens() int { return 0 }
func (s stub) Screen(scrN int) *oswin.Screen { return nil }
func (s stub) ScreenByName(name string) *oswin.Screen { return nil }
func (s stub) NWindows() int { return 0 }
func (s stub) Window(win int) oswin.Window { return nil }
func (s stub) WindowByName(name string) oswin.Window { return nil }
func (s stub) WindowInFocus() oswin.Window { return nil }
func (s stub) ContextWindow() oswin.Window { return nil }
func (s stub) ClipBoard(win oswin.Window) clip.Board { return nil }
func (s stub) Cursor(win oswin.Window) cursor.Cursor { return nil }
func (s stub) Platform() oswin.Platforms { return oswin.PlatformsN }
func (s stub) Name() string { return "" }
func (s stub) SetName(name string) {}
func (s stub) PrefsDir() string { return "" }
func (s stub) GoGiPrefsDir() string { return "" }
func (s stub) AppPrefsDir() string { return "" }
func (s stub) FontPaths() []string { return nil }
func (s stub) About() string { return "" }
func (s stub) SetAbout(about string) {}
func (s stub) OpenURL(url string) {}
func (s stub) SetQuitReqFunc(fun func()) {}
func (s stub) SetQuitCleanFunc(fun func()) {}
func (s stub) IsQuitting() bool { return false }
func (s stub) QuitReq() {}
func (s stub) QuitClean() {}
func (s stub) Quit() {}
// check for interface implementation
var _ oswin.App = &stub{}