summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--button.go6
-rw-r--r--checkbox.go6
-rw-r--r--sysdata.go8
-rw-r--r--window.go6
4 files changed, 11 insertions, 15 deletions
diff --git a/button.go b/button.go
index c3f5c7e..2c6706f 100644
--- a/button.go
+++ b/button.go
@@ -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,
}
}
diff --git a/sysdata.go b/sysdata.go
index 3ffc4c0..eda749e 100644
--- a/sysdata.go
+++ b/sysdata.go
@@ -36,3 +36,11 @@ const (
c_checkbox
nctypes
)
+
+func mksysdata(ctype int) *sysData {
+ return &sysData{
+ cSysData: cSysData{
+ ctype: ctype,
+ },
+ }
+}
diff --git a/window.go b/window.go
index da5606a..5bf167a 100644
--- a/window.go
+++ b/window.go
@@ -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,