Changed the cSysData dummy functions to an interface that a dummy sysData instance is tested against to make sure that not only all functions exist, but also that they are all the correct type.
This commit is contained in:
parent
593ded848b
commit
dbbabf35c3
84
sysdata.go
84
sysdata.go
|
@ -2,10 +2,6 @@
|
||||||
|
|
||||||
package ui
|
package ui
|
||||||
|
|
||||||
import (
|
|
||||||
"runtime"
|
|
||||||
)
|
|
||||||
|
|
||||||
const eventbufsiz = 100 // suggested by skelterjohn
|
const eventbufsiz = 100 // suggested by skelterjohn
|
||||||
|
|
||||||
// newEvent returns a new channel suitable for listening for events.
|
// newEvent returns a new channel suitable for listening for events.
|
||||||
|
@ -22,63 +18,29 @@ type cSysData struct {
|
||||||
alternate bool // editable for Combobox, multi-select for listbox, password for lineedit
|
alternate bool // editable for Combobox, multi-select for listbox, password for lineedit
|
||||||
handler AreaHandler // for Areas
|
handler AreaHandler // for Areas
|
||||||
}
|
}
|
||||||
func (c *cSysData) make(initText string, window *sysData) error {
|
|
||||||
panic(runtime.GOOS + " sysData does not define make()")
|
// this interface is used to make sure all sysDatas are synced
|
||||||
}
|
var _xSysData interface {
|
||||||
func (c *cSysData) firstShow() error {
|
make(initText string, window *sysData) error
|
||||||
panic(runtime.GOOS + " sysData does not define firstShow()")
|
firstShow() error
|
||||||
}
|
show()
|
||||||
func (c *cSysData) show() {
|
hide()
|
||||||
panic(runtime.GOOS + " sysData does not define show()")
|
setText(text string)
|
||||||
}
|
setRect(x int, y int, width int, height int, winheight int) error
|
||||||
func (c *cSysData) hide() {
|
isChecked() bool
|
||||||
panic(runtime.GOOS + " sysData does not define hide()")
|
text() string
|
||||||
}
|
append(string)
|
||||||
func (c *cSysData) setText(text string) {
|
insertBefore(string, int)
|
||||||
panic(runtime.GOOS + " sysData does not define setText()")
|
selectedIndex() int
|
||||||
}
|
selectedIndices() []int
|
||||||
func (c *cSysData) setRect(x int, y int, width int, height int, winheight int) error {
|
selectedTexts() []string
|
||||||
panic(runtime.GOOS + " sysData does not define setRect()")
|
setWindowSize(int, int) error
|
||||||
}
|
delete(int)
|
||||||
func (c *cSysData) isChecked() bool {
|
preferredSize() (int, int)
|
||||||
panic(runtime.GOOS + " sysData does not define isChecked()")
|
setProgress(int)
|
||||||
}
|
len() int
|
||||||
func (c *cSysData) text() string {
|
setAreaSize(int, int)
|
||||||
panic(runtime.GOOS + " sysData does not define text()")
|
} = &sysData{} // this line will error if there's an inconsistency
|
||||||
}
|
|
||||||
func (c *cSysData) append(string) {
|
|
||||||
panic(runtime.GOOS + " sysData does not define append()")
|
|
||||||
}
|
|
||||||
func (c *cSysData) insertBefore(string, int) {
|
|
||||||
panic(runtime.GOOS + " sysData does not define insertBefore()")
|
|
||||||
}
|
|
||||||
func (c *cSysData) selectedIndex() int {
|
|
||||||
panic(runtime.GOOS + " sysData does not define selectedIndex()")
|
|
||||||
}
|
|
||||||
func (c *cSysData) selectedIndices() []int {
|
|
||||||
panic(runtime.GOOS + " sysData does not define selectedIndices()")
|
|
||||||
}
|
|
||||||
func (c *cSysData) selectedTexts() []string {
|
|
||||||
panic(runtime.GOOS + " sysData does not define selectedIndex()")
|
|
||||||
}
|
|
||||||
func (c *cSysData) setWindowSize(int, int) error {
|
|
||||||
panic(runtime.GOOS + " sysData does not define setWindowSize()")
|
|
||||||
}
|
|
||||||
func (c *cSysData) delete(int) {
|
|
||||||
panic(runtime.GOOS + " sysData does not define delete()")
|
|
||||||
}
|
|
||||||
func (c *cSysData) preferredSize() (int, int) {
|
|
||||||
panic(runtime.GOOS + " sysData does not define preferredSize()")
|
|
||||||
}
|
|
||||||
func (c *cSysData) setProgress(int) {
|
|
||||||
panic(runtime.GOOS + " sysData does not define setProgress()")
|
|
||||||
}
|
|
||||||
func (c *cSysData) len() int {
|
|
||||||
panic(runtime.GOOS + " sysData does not define len()")
|
|
||||||
}
|
|
||||||
func (c *cSysData) setAreaSize(int, int) {
|
|
||||||
panic(runtime.GOOS + " sysData does not define setAreaSize()")
|
|
||||||
}
|
|
||||||
|
|
||||||
// signal sends the event signal. This raise is done asynchronously to avoid deadlocking the UI task.
|
// signal sends the event signal. This raise is done asynchronously to avoid deadlocking the UI task.
|
||||||
// Thanks skelterjohn for this techinque: if we can't queue any more events, drop them
|
// Thanks skelterjohn for this techinque: if we can't queue any more events, drop them
|
||||||
|
|
Loading…
Reference in New Issue