summaryrefslogtreecommitdiff
path: root/AAA_GOFILES/datetimepicker.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2018-08-11 16:18:01 -0400
committerPietro Gagliardi <[email protected]>2018-08-11 16:18:01 -0400
commit308e253e0f7873710bf77312d7a12c576aaa9781 (patch)
treefd20704da886ce82a3621ec1502897a8766b11be /AAA_GOFILES/datetimepicker.go
parent0f75ebb5fa7a12bd1df26622ed3f5544a9d1d32b (diff)
Moved the existing .go files out of the way and replaced ui.h with the alpha4 ui.h.
Diffstat (limited to 'AAA_GOFILES/datetimepicker.go')
-rw-r--r--AAA_GOFILES/datetimepicker.go92
1 files changed, 92 insertions, 0 deletions
diff --git a/AAA_GOFILES/datetimepicker.go b/AAA_GOFILES/datetimepicker.go
new file mode 100644
index 0000000..216b8b7
--- /dev/null
+++ b/AAA_GOFILES/datetimepicker.go
@@ -0,0 +1,92 @@
+// 12 december 2015
+
+package ui
+
+import (
+ "unsafe"
+)
+
+// #include "ui.h"
+import "C"
+
+// DateTimePicker is a Control that represents a field where the user
+// can enter a date and/or a time.
+type DateTimePicker struct {
+ c *C.uiControl
+ d *C.uiDateTimePicker
+}
+
+// NewDateTimePicker creates a new DateTimePicker that shows
+// both a date and a time.
+func NewDateTimePicker() *DateTimePicker {
+ d := new(DateTimePicker)
+
+ d.d = C.uiNewDateTimePicker()
+ d.c = (*C.uiControl)(unsafe.Pointer(d.d))
+
+ return d
+}
+
+// NewDatePicker creates a new DateTimePicker that shows
+// only a date.
+func NewDatePicker() *DateTimePicker {
+ d := new(DateTimePicker)
+
+ d.d = C.uiNewDatePicker()
+ d.c = (*C.uiControl)(unsafe.Pointer(d.d))
+
+ return d
+}
+
+// NewTimePicker creates a new DateTimePicker that shows
+// only a time.
+func NewTimePicker() *DateTimePicker {
+ d := new(DateTimePicker)
+
+ d.d = C.uiNewTimePicker()
+ d.c = (*C.uiControl)(unsafe.Pointer(d.d))
+
+ return d
+}
+
+// Destroy destroys the DateTimePicker.
+func (d *DateTimePicker) Destroy() {
+ C.uiControlDestroy(d.c)
+}
+
+// LibuiControl returns the libui uiControl pointer that backs
+// the Window. This is only used by package ui itself and should
+// not be called by programs.
+func (d *DateTimePicker) LibuiControl() uintptr {
+ return uintptr(unsafe.Pointer(d.c))
+}
+
+// Handle returns the OS-level handle associated with this DateTimePicker.
+// On Windows this is an HWND of a standard Windows API
+// DATETIMEPICK_CLASS class (as provided by Common Controls
+// version 6).
+// On GTK+ this is a pointer to a libui-internal class.
+// On OS X this is a pointer to a NSDatePicker.
+func (d *DateTimePicker) Handle() uintptr {
+ return uintptr(C.uiControlHandle(d.c))
+}
+
+// Show shows the DateTimePicker.
+func (d *DateTimePicker) Show() {
+ C.uiControlShow(d.c)
+}
+
+// Hide hides the DateTimePicker.
+func (d *DateTimePicker) Hide() {
+ C.uiControlHide(d.c)
+}
+
+// Enable enables the DateTimePicker.
+func (d *DateTimePicker) Enable() {
+ C.uiControlEnable(d.c)
+}
+
+// Disable disables the DateTimePicker.
+func (d *DateTimePicker) Disable() {
+ C.uiControlDisable(d.c)
+}