diff options
| -rw-r--r-- | button.go | 6 | ||||
| -rw-r--r-- | checkbox.go | 6 | ||||
| -rw-r--r-- | sysdata.go | 8 | ||||
| -rw-r--r-- | window.go | 6 |
4 files changed, 11 insertions, 15 deletions
@@ -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{}), } diff --git a/checkbox.go b/checkbox.go index 89768ef..fc5c197 100644 --- a/checkbox.go +++ b/checkbox.go @@ -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, |
