Changed manual sysData construction to use a helper function instead.
This commit is contained in:
parent
9a4e7bf5eb
commit
8407bfb0cb
|
@ -19,11 +19,7 @@ type Button struct {
|
|||
// NewButton creates a new button with the specified text.
|
||||
func NewButton(text string) (b *Button) {
|
||||
return &Button{
|
||||
sysData: &sysData{
|
||||
cSysData: cSysData{
|
||||
ctype: c_button,
|
||||
},
|
||||
},
|
||||
sysData: mksysdata(c_button),
|
||||
initText: text,
|
||||
Clicked: make(chan struct{}),
|
||||
}
|
||||
|
|
|
@ -20,11 +20,7 @@ type Checkbox struct {
|
|||
// NewCheckbox creates a new checkbox with the specified text.
|
||||
func NewCheckbox(text string) (c *Checkbox) {
|
||||
return &Checkbox{
|
||||
sysData: &sysData{
|
||||
cSysData: cSysData{
|
||||
ctype: c_checkbox,
|
||||
},
|
||||
},
|
||||
sysData: mksysdata(c_checkbox),
|
||||
initText: text,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,3 +36,11 @@ const (
|
|||
c_checkbox
|
||||
nctypes
|
||||
)
|
||||
|
||||
func mksysdata(ctype int) *sysData {
|
||||
return &sysData{
|
||||
cSysData: cSysData{
|
||||
ctype: ctype,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,11 +25,7 @@ type Window struct {
|
|||
// NewWindow creates a new window with the given title and size. The window is not constructed at the OS level until a call to Open().
|
||||
func NewWindow(title string, width int, height int) *Window {
|
||||
return &Window{
|
||||
sysData: &sysData{
|
||||
cSysData: cSysData{
|
||||
ctype: c_window,
|
||||
},
|
||||
},
|
||||
sysData: mksysdata(c_window),
|
||||
initTitle: title,
|
||||
initWidth: width,
|
||||
initHeight: height,
|
||||
|
|
Loading…
Reference in New Issue