diff options
| author | Pietro Gagliardi <[email protected]> | 2014-10-28 11:01:02 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-10-28 11:01:02 -0400 |
| commit | 649b52b6ef273c2ea5a4cf881835a7fd61bd4df1 (patch) | |
| tree | d22a9317599e6b03ecd4b1de0d753c71bdfe306b /spinbox_unix.go | |
| parent | 61cd7f5b0a70f261f65fc790fadf9d6ea64e8b4f (diff) | |
Set up the absolute basic Spinbox and implemented it on GTK+. This is easy as it's one control on GTK+; now we have to do it on Windows and Mac OS X. And on those platforms, those are two separate controls (a standard edit control and an up-down/NSSpinner).
Diffstat (limited to 'spinbox_unix.go')
| -rw-r--r-- | spinbox_unix.go | 30 |
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 +} |
