diff options
Diffstat (limited to 'AAA_GOFILES')
| -rw-r--r-- | AAA_GOFILES/label.go | 85 | ||||
| -rw-r--r-- | AAA_GOFILES/progressbar.go | 77 | ||||
| -rw-r--r-- | AAA_GOFILES/radiobuttons.go | 77 | ||||
| -rw-r--r-- | AAA_GOFILES/separator.go | 68 | ||||
| -rw-r--r-- | AAA_GOFILES/slider.go | 108 | ||||
| -rw-r--r-- | AAA_GOFILES/spinbox.go | 111 |
6 files changed, 0 insertions, 526 deletions
diff --git a/AAA_GOFILES/label.go b/AAA_GOFILES/label.go deleted file mode 100644 index e143d50..0000000 --- a/AAA_GOFILES/label.go +++ /dev/null @@ -1,85 +0,0 @@ -// 12 december 2015 - -package ui - -import ( - "unsafe" -) - -// #include "ui.h" -import "C" - -// Label is a Control that represents a line of text that cannot be -// interacted with. TODO rest of documentation. -type Label struct { - c *C.uiControl - l *C.uiLabel -} - -// NewLabel creates a new Label with the given text. -func NewLabel(text string) *Label { - l := new(Label) - - ctext := C.CString(text) - l.l = C.uiNewLabel(ctext) - l.c = (*C.uiControl)(unsafe.Pointer(l.l)) - freestr(ctext) - - return l -} - -// Destroy destroys the Label. -func (l *Label) Destroy() { - C.uiControlDestroy(l.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 (l *Label) LibuiControl() uintptr { - return uintptr(unsafe.Pointer(l.c)) -} - -// Handle returns the OS-level handle associated with this Label. -// On Windows this is an HWND of a standard Windows API STATIC -// class (as provided by Common Controls version 6). -// On GTK+ this is a pointer to a GtkLabel. -// On OS X this is a pointer to a NSTextField. -func (l *Label) Handle() uintptr { - return uintptr(C.uiControlHandle(l.c)) -} - -// Show shows the Label. -func (l *Label) Show() { - C.uiControlShow(l.c) -} - -// Hide hides the Label. -func (l *Label) Hide() { - C.uiControlHide(l.c) -} - -// Enable enables the Label. -func (l *Label) Enable() { - C.uiControlEnable(l.c) -} - -// Disable disables the Label. -func (l *Label) Disable() { - C.uiControlDisable(l.c) -} - -// Text returns the Label's text. -func (l *Label) Text() string { - ctext := C.uiLabelText(l.l) - text := C.GoString(ctext) - C.uiFreeText(ctext) - return text -} - -// SetText sets the Label's text to text. -func (l *Label) SetText(text string) { - ctext := C.CString(text) - C.uiLabelSetText(l.l, ctext) - freestr(ctext) -} diff --git a/AAA_GOFILES/progressbar.go b/AAA_GOFILES/progressbar.go deleted file mode 100644 index ef5116c..0000000 --- a/AAA_GOFILES/progressbar.go +++ /dev/null @@ -1,77 +0,0 @@ -// 12 december 2015 - -package ui - -import ( - "unsafe" -) - -// #include "ui.h" -import "C" - -// ProgressBar is a Control that represents a horizontal bar that -// is filled in progressively over time as a process completes. -type ProgressBar struct { - c *C.uiControl - p *C.uiProgressBar -} - -// NewProgressBar creates a new ProgressBar. -func NewProgressBar() *ProgressBar { - p := new(ProgressBar) - - p.p = C.uiNewProgressBar() - p.c = (*C.uiControl)(unsafe.Pointer(p.p)) - - return p -} - -// Destroy destroys the ProgressBar. -func (p *ProgressBar) Destroy() { - C.uiControlDestroy(p.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 (p *ProgressBar) LibuiControl() uintptr { - return uintptr(unsafe.Pointer(p.c)) -} - -// Handle returns the OS-level handle associated with this ProgressBar. -// On Windows this is an HWND of a standard Windows API -// PROGRESS_CLASS class (as provided by Common Controls -// version 6). -// On GTK+ this is a pointer to a GtkProgressBar. -// On OS X this is a pointer to a NSProgressIndicator. -func (p *ProgressBar) Handle() uintptr { - return uintptr(C.uiControlHandle(p.c)) -} - -// Show shows the ProgressBar. -func (p *ProgressBar) Show() { - C.uiControlShow(p.c) -} - -// Hide hides the ProgressBar. -func (p *ProgressBar) Hide() { - C.uiControlHide(p.c) -} - -// Enable enables the ProgressBar. -func (p *ProgressBar) Enable() { - C.uiControlEnable(p.c) -} - -// Disable disables the ProgressBar. -func (p *ProgressBar) Disable() { - C.uiControlDisable(p.c) -} - -// TODO Value - -// SetValue sets the ProgressBar's currently displayed percentage -// to value. value must be between 0 and 100 inclusive. -func (p *ProgressBar) SetValue(value int) { - C.uiProgressBarSetValue(p.p, C.int(value)) -} diff --git a/AAA_GOFILES/radiobuttons.go b/AAA_GOFILES/radiobuttons.go deleted file mode 100644 index b8399ea..0000000 --- a/AAA_GOFILES/radiobuttons.go +++ /dev/null @@ -1,77 +0,0 @@ -// 12 december 2015 - -package ui - -import ( - "unsafe" -) - -// #include "ui.h" -import "C" - -// RadioButtons is a Control that represents a set of checkable -// buttons from which exactly one may be chosen by the user. -type RadioButtons struct { - c *C.uiControl - r *C.uiRadioButtons -} - -// NewRadioButtons creates a new RadioButtons. -func NewRadioButtons() *RadioButtons { - r := new(RadioButtons) - - r.r = C.uiNewRadioButtons() - r.c = (*C.uiControl)(unsafe.Pointer(r.r)) - - return r -} - -// Destroy destroys the RadioButtons. -func (r *RadioButtons) Destroy() { - C.uiControlDestroy(r.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 (r *RadioButtons) LibuiControl() uintptr { - return uintptr(unsafe.Pointer(r.c)) -} - -// Handle returns the OS-level handle associated with this RadioButtons. -// On Windows this is an HWND of a libui-internal class; its -// child windows are instances of the standard Windows API -// BUTTON class (as provided by Common Controls version 6). -// On GTK+ this is a pointer to a GtkBox containing GtkRadioButtons. -// On OS X this is a pointer to a NSView with each radio button as a NSButton subview. -func (r *RadioButtons) Handle() uintptr { - return uintptr(C.uiControlHandle(r.c)) -} - -// Show shows the RadioButtons. -func (r *RadioButtons) Show() { - C.uiControlShow(r.c) -} - -// Hide hides the RadioButtons. -func (r *RadioButtons) Hide() { - C.uiControlHide(r.c) -} - -// Enable enables the RadioButtons. -func (r *RadioButtons) Enable() { - C.uiControlEnable(r.c) -} - -// Disable disables the RadioButtons. -func (r *RadioButtons) Disable() { - C.uiControlDisable(r.c) -} - -// Append adds the named button to the end of the RadioButtons. -// If this button is the first button, it is automatically selected. -func (r *RadioButtons) Append(text string) { - ctext := C.CString(text) - C.uiRadioButtonsAppend(r.r, ctext) - freestr(ctext) -} diff --git a/AAA_GOFILES/separator.go b/AAA_GOFILES/separator.go deleted file mode 100644 index 5f41891..0000000 --- a/AAA_GOFILES/separator.go +++ /dev/null @@ -1,68 +0,0 @@ -// 12 december 2015 - -package ui - -import ( - "unsafe" -) - -// #include "ui.h" -import "C" - -// Separator is a Control that represents a horizontal line that -// visually separates controls. -type Separator struct { - c *C.uiControl - s *C.uiSeparator -} - -// NewSeparator creates a new horizontal Separator. -func NewHorizontalSeparator() *Separator { - s := new(Separator) - - s.s = C.uiNewHorizontalSeparator() - s.c = (*C.uiControl)(unsafe.Pointer(s.s)) - - return s -} - -// Destroy destroys the Separator. -func (s *Separator) Destroy() { - C.uiControlDestroy(s.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 (s *Separator) LibuiControl() uintptr { - return uintptr(unsafe.Pointer(s.c)) -} - -// Handle returns the OS-level handle associated with this Separator. -// On Windows this is an HWND of a standard Windows API STATIC -// class (as provided by Common Controls version 6). -// On GTK+ this is a pointer to a GtkSeparator. -// On OS X this is a pointer to a NSBox. -func (s *Separator) Handle() uintptr { - return uintptr(C.uiControlHandle(s.c)) -} - -// Show shows the Separator. -func (s *Separator) Show() { - C.uiControlShow(s.c) -} - -// Hide hides the Separator. -func (s *Separator) Hide() { - C.uiControlHide(s.c) -} - -// Enable enables the Separator. -func (s *Separator) Enable() { - C.uiControlEnable(s.c) -} - -// Disable disables the Separator. -func (s *Separator) Disable() { - C.uiControlDisable(s.c) -} diff --git a/AAA_GOFILES/slider.go b/AAA_GOFILES/slider.go deleted file mode 100644 index 99b8d2c..0000000 --- a/AAA_GOFILES/slider.go +++ /dev/null @@ -1,108 +0,0 @@ -// 12 december 2015 - -package ui - -import ( - "unsafe" -) - -// #include "ui.h" -// extern void doSliderOnChanged(uiSlider *, void *); -// static inline void realuiSliderOnChanged(uiSlider *b) -// { -// uiSliderOnChanged(b, doSliderOnChanged, NULL); -// } -import "C" - -// no need to lock this; only the GUI thread can access it -var sliders = make(map[*C.uiSlider]*Slider) - -// Slider is a Control that represents a horizontal bar that represents -// a range of integers. The user can drag a pointer on the bar to -// select an integer. -type Slider struct { - c *C.uiControl - s *C.uiSlider - - onChanged func(*Slider) -} - -// NewSlider creates a new Slider. If min >= max, they are swapped. -func NewSlider(min int, max int) *Slider { - s := new(Slider) - - s.s = C.uiNewSlider(C.intmax_t(min), C.intmax_t(max)) - s.c = (*C.uiControl)(unsafe.Pointer(s.s)) - - C.realuiSliderOnChanged(s.s) - sliders[s.s] = s - - return s -} - -// Destroy destroys the Slider. -func (s *Slider) Destroy() { - delete(sliders, s.s) - C.uiControlDestroy(s.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 (s *Slider) LibuiControl() uintptr { - return uintptr(unsafe.Pointer(s.c)) -} - -// Handle returns the OS-level handle associated with this Slider. -// On Windows this is an HWND of a standard Windows API -// TRACKBAR_CLASS class (as provided by Common Controls -// version 6). -// On GTK+ this is a pointer to a GtkScale. -// On OS X this is a pointer to a NSSlider. -func (s *Slider) Handle() uintptr { - return uintptr(C.uiControlHandle(s.c)) -} - -// Show shows the Slider. -func (s *Slider) Show() { - C.uiControlShow(s.c) -} - -// Hide hides the Slider. -func (s *Slider) Hide() { - C.uiControlHide(s.c) -} - -// Enable enables the Slider. -func (s *Slider) Enable() { - C.uiControlEnable(s.c) -} - -// Disable disables the Slider. -func (s *Slider) Disable() { - C.uiControlDisable(s.c) -} - -// Value returns the Slider's current value. -func (s *Slider) Value() int { - return int(C.uiSliderValue(s.s)) -} - -// SetText sets the Slider's current value to value. -func (s *Slider) SetValue(value int) { - C.uiSliderSetValue(s.s, C.intmax_t(value)) -} - -// OnChanged registers f to be run when the user changes the value -// of the Slider. Only one function can be registered at a time. -func (s *Slider) OnChanged(f func(*Slider)) { - s.onChanged = f -} - -//export doSliderOnChanged -func doSliderOnChanged(ss *C.uiSlider, data unsafe.Pointer) { - s := sliders[ss] - if s.onChanged != nil { - s.onChanged(s) - } -} diff --git a/AAA_GOFILES/spinbox.go b/AAA_GOFILES/spinbox.go deleted file mode 100644 index 5e5e43f..0000000 --- a/AAA_GOFILES/spinbox.go +++ /dev/null @@ -1,111 +0,0 @@ -// 12 december 2015 - -package ui - -import ( - "unsafe" -) - -// #include "ui.h" -// extern void doSpinboxOnChanged(uiSpinbox *, void *); -// static inline void realuiSpinboxOnChanged(uiSpinbox *b) -// { -// uiSpinboxOnChanged(b, doSpinboxOnChanged, NULL); -// } -import "C" - -// no need to lock this; only the GUI thread can access it -var spinboxes = make(map[*C.uiSpinbox]*Spinbox) - -// Spinbox is a Control that represents a space where the user can -// enter integers. The space also comes with buttons to add or -// subtract 1 from the integer. -type Spinbox struct { - c *C.uiControl - s *C.uiSpinbox - - onChanged func(*Spinbox) -} - -// NewSpinbox creates a new Spinbox. If min >= max, they are swapped. -func NewSpinbox(min int, max int) *Spinbox { - s := new(Spinbox) - - s.s = C.uiNewSpinbox(C.intmax_t(min), C.intmax_t(max)) - s.c = (*C.uiControl)(unsafe.Pointer(s.s)) - - C.realuiSpinboxOnChanged(s.s) - spinboxes[s.s] = s - - return s -} - -// Destroy destroys the Spinbox. -func (s *Spinbox) Destroy() { - delete(spinboxes, s.s) - C.uiControlDestroy(s.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 (s *Spinbox) LibuiControl() uintptr { - return uintptr(unsafe.Pointer(s.c)) -} - -// Handle returns the OS-level handle associated with this Spinbox. -// On Windows this is an HWND of a standard Windows API EDIT -// class (as provided by Common Controls version 6). Due to -// various limitations which affect the lifetime of the associated -// Common Controls version 6 UPDOWN_CLASS window that -// provides the buttons, there is no way to access it. -// On GTK+ this is a pointer to a GtkSpinButton. -// On OS X this is a pointer to a NSView that contains a NSTextField -// and a NSStepper as subviews. -func (s *Spinbox) Handle() uintptr { - return uintptr(C.uiControlHandle(s.c)) -} - -// Show shows the Spinbox. -func (s *Spinbox) Show() { - C.uiControlShow(s.c) -} - -// Hide hides the Spinbox. -func (s *Spinbox) Hide() { - C.uiControlHide(s.c) -} - -// Enable enables the Spinbox. -func (s *Spinbox) Enable() { - C.uiControlEnable(s.c) -} - -// Disable disables the Spinbox. -func (s *Spinbox) Disable() { - C.uiControlDisable(s.c) -} - -// Value returns the Spinbox's current value. -func (s *Spinbox) Value() int { - return int(C.uiSpinboxValue(s.s)) -} - -// SetText sets the Spinbox's current value to value. -func (s *Spinbox) SetValue(value int) { - C.uiSpinboxSetValue(s.s, C.intmax_t(value)) -} - -// OnChanged registers f to be run when the user changes the value -// of the Spinbox. Only one function can be registered at a time. -func (s *Spinbox) OnChanged(f func(*Spinbox)) { - s.onChanged = f -} - -//export doSpinboxOnChanged -func doSpinboxOnChanged(ss *C.uiSpinbox, data unsafe.Pointer) { - s := spinboxes[ss] - if s.onChanged != nil { - s.onChanged(s) - } -} |
