2014-02-11 15:14:15 -06:00
// 11 february 2014
2014-03-12 20:55:45 -05:00
2014-02-19 10:41:10 -06:00
package ui
2014-02-11 15:14:15 -06:00
// 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
2014-06-25 22:21:57 -05:00
allocate func ( x int , y int , width int , height int , d * sysSizeData ) [ ] * allocation
2014-06-25 21:07:37 -05:00
spaced bool
2014-06-10 09:22:30 -05:00
alternate bool // editable for Combobox, multi-select for listbox, password for lineedit
2014-06-28 00:22:40 -05:00
handler AreaHandler // for Areas; TODO rename to areahandler
winhandler WindowHandler // for Windows
2014-06-28 00:57:07 -05:00
close func ( * bool ) // provided by each Window
event func ( ) // provided by each control
2014-02-11 15:14:15 -06:00
}
2014-04-01 14:34:51 -05:00
// this interface is used to make sure all sysDatas are synced
var _xSysData interface {
2014-06-25 21:07:37 -05:00
sysDataSizingFunctions
2014-04-01 15:43:56 -05:00
make ( window * sysData ) error
2014-04-01 14:34:51 -05:00
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 )
2014-06-09 21:11:08 -05:00
repaintAll ( )
2014-06-11 09:01:55 -05:00
center ( )
2014-06-26 20:36:46 -05:00
setChecked ( bool )
2014-06-10 09:22:30 -05:00
} = & sysData { } // this line will error if there's an inconsistency
2014-02-11 15:14:15 -06:00
const (
c_window = iota
c_button
2014-02-13 11:26:43 -06:00
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
2014-02-14 15:25:39 -06:00
c_listbox
2014-02-24 23:13:47 -06:00
c_progressbar
2014-03-14 17:47:18 -05:00
c_area
2014-02-11 18:09:10 -06:00
nctypes
2014-02-11 15:14:15 -06:00
)
2014-02-14 10:02:59 -06:00
func mksysdata ( ctype int ) * sysData {
2014-03-17 20:09:03 -05:00
s := & sysData {
2014-06-10 09:22:30 -05:00
cSysData : cSysData {
ctype : ctype ,
2014-02-14 10:02:59 -06:00
} ,
}
2014-03-17 20:09:03 -05:00
return s
2014-02-14 10:02:59 -06:00
}