summaryrefslogtreecommitdiff
path: root/spinbox_unix.go
diff options
context:
space:
mode:
Diffstat (limited to 'spinbox_unix.go')
-rw-r--r--spinbox_unix.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/spinbox_unix.go b/spinbox_unix.go
new file mode 100644
index 0000000..33ac2f3
--- /dev/null
+++ b/spinbox_unix.go
@@ -0,0 +1,30 @@
+// +build !windows,!darwin
+
+// 28 october 2014
+
+package ui
+
+import (
+ "unsafe"
+)
+
+// #include "gtk_unix.h"
+import "C"
+
+// TODO preferred width may be too wide
+
+type spinbox struct {
+ *controlSingleWidget
+ spinbutton *C.GtkSpinButton
+}
+
+func newSpinbox() Spinbox {
+ widget := C.gtk_spin_button_new_with_range(0, 100, 1)
+ s := &spinbox{
+ controlSingleWidget: newControlSingleWidget(widget),
+ spinbutton: (*C.GtkSpinButton)(unsafe.Pointer(widget)),
+ }
+ C.gtk_spin_button_set_digits(s.spinbutton, 0) // integers
+ C.gtk_spin_button_set_numeric(s.spinbutton, C.TRUE) // digits only
+ return s
+}