andlabs-ui/sysdata.go

63 lines
1.4 KiB
Go
Raw Normal View History

// 11 february 2014
package ui
// The sysData type contains all system data. It provides the system-specific underlying implementation. It is guaranteed to have the following by embedding:
type cSysData struct {
2014-06-10 09:22:30 -05:00
ctype int
allocate func(x int, y int, width int, height int, d *sysSizeData) []*allocation
spaced bool
2014-06-10 09:22:30 -05:00
alternate bool // editable for Combobox, multi-select for listbox, password for lineedit
handler AreaHandler // for Areas; TODO rename to areahandler
winhandler WindowHandler // for Windows
close func(*bool) // provided by each Window
event func() // provided by each control
}
// this interface is used to make sure all sysDatas are synced
var _xSysData interface {
sysDataSizingFunctions
make(window *sysData) error
firstShow() error
show()
hide()
setText(text string)
setRect(x int, y int, width int, height int, winheight int) error
isChecked() bool
text() string
append(string)
insertBefore(string, int)
selectedIndex() int
selectedIndices() []int
selectedTexts() []string
setWindowSize(int, int) error
setProgress(int)
len() int
setAreaSize(int, int)
repaintAll()
center()
setChecked(bool)
2014-06-10 09:22:30 -05:00
} = &sysData{} // this line will error if there's an inconsistency
const (
c_window = iota
c_button
c_checkbox
2014-02-14 11:16:27 -06:00
c_combobox
2014-02-14 14:00:59 -06:00
c_lineedit
2014-02-14 14:12:03 -06:00
c_label
c_listbox
2014-02-24 23:13:47 -06:00
c_progressbar
c_area
nctypes
)
func mksysdata(ctype int) *sysData {
s := &sysData{
2014-06-10 09:22:30 -05:00
cSysData: cSysData{
ctype: ctype,
},
}
return s
}