summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2018-08-26 13:43:05 -0400
committerPietro Gagliardi <[email protected]>2018-08-26 13:43:05 -0400
commit7b7ae9d7ce2aa6f99677fde7b8a0c21c7024e3e9 (patch)
tree17813999d509a6dd0d1636f415622876c0d6ff93
parent1095719d84a6ac5f90eefe8e23913f3e09ad692d (diff)
More control migration. Everything beyond this point is nontrivial.
-rw-r--r--multilineentry.go (renamed from BBB_GOFILES/multilineentry.go)11
-rw-r--r--pkgui.c20
-rw-r--r--pkgui.h12
-rw-r--r--radiobuttons.go (renamed from BBB_GOFILES/radiobuttons.go)11
-rw-r--r--separator.go (renamed from BBB_GOFILES/separator.go)2
-rw-r--r--slider.go (renamed from BBB_GOFILES/slider.go)11
-rw-r--r--spinbox.go (renamed from BBB_GOFILES/spinbox.go)11
-rw-r--r--tab.go (renamed from BBB_GOFILES/tab.go)2
8 files changed, 50 insertions, 30 deletions
diff --git a/BBB_GOFILES/multilineentry.go b/multilineentry.go
index 88a75c4..34ba637 100644
--- a/BBB_GOFILES/multilineentry.go
+++ b/multilineentry.go
@@ -10,10 +10,7 @@ import (
"unsafe"
)
-// #include "ui.h"
-// extern void doMultilineEntryOnChanged(uiMultilineEntry *, void *);
-// // see golang/go#19835
-// typedef void (*multilineEntryCallback)(uiMultilineEntry *, void *);
+// #include "pkgui.h"
import "C"
// MultilineEntry is a Control that represents a space that the user
@@ -29,7 +26,7 @@ func finishNewMultilineEntry(ee *C.uiMultilineEntry) *MultilineEntry {
m.e = ee
- C.uiMultilineEntryOnChanged(m.e, C.multilineEntryCallback(C.doMultilineEntryOnChanged), nil)
+ C.pkguiMultilineEntryOnChanged(m.e)
m.ControlBase = NewControlBase(m, uintptr(unsafe.Pointer(m.e)))
return m
@@ -78,8 +75,8 @@ func (m *MultilineEntry) OnChanged(f func(*MultilineEntry)) {
m.onChanged = f
}
-//export doMultilineEntryOnChanged
-func doMultilineEntryOnChanged(ee *C.uiMultilineEntry, data unsafe.Pointer) {
+//export pkguiDoMultilineEntryOnChanged
+func pkguiDoMultilineEntryOnChanged(ee *C.uiMultilineEntry, data unsafe.Pointer) {
m := ControlFromLibui(uintptr(unsafe.Pointer(ee))).(*MultilineEntry)
if m.onChanged != nil {
m.onChanged(m)
diff --git a/pkgui.c b/pkgui.c
index 643f50e..cdc2a3f 100644
--- a/pkgui.c
+++ b/pkgui.c
@@ -51,3 +51,23 @@ void pkguiEntryOnChanged(uiEntry *e)
{
uiEntryOnChanged(e, pkguiDoEntryOnChanged, NULL);
}
+
+void pkguiMultilineEntryOnChanged(uiMultilineEntry *e)
+{
+ uiMultilineEntryOnChanged(e, pkguiDoMultilineEntryOnChanged, NULL);
+}
+
+void pkguiRadioButtonsOnSelected(uiRadioButtons *r)
+{
+ uiRadioButtonsOnSelected(r, pkguiDoRadioButtonsOnSelected, NULL);
+}
+
+void pkguiSliderOnChanged(uiSlider *s)
+{
+ uiSliderOnChanged(s, pkguiDoSliderOnChanged, NULL);
+}
+
+void pkguiSpinboxOnChanged(uiSpinbox *s)
+{
+ uiSpinboxOnChanged(s, pkguiDoSpinboxOnChanged, NULL);
+}
diff --git a/pkgui.h b/pkgui.h
index eefea53..418f781 100644
--- a/pkgui.h
+++ b/pkgui.h
@@ -29,4 +29,16 @@ extern void pkguiEditableComboboxOnChanged(uiEditableCombobox *c);
// entry.go
extern void pkguiEntryOnChanged(uiEntry *e);
+// multilineentry.go
+extern void pkguiMultilineEntryOnChanged(uiMultilineEntry *e);
+
+// radiobuttons.go
+extern void pkguiRadioButtonsOnSelected(uiRadioButtons *r);
+
+// slider.go
+extern void pkguiSliderOnChanged(uiSlider *s);
+
+// spinbox.go
+extern void pkguiSpinboxOnChanged(uiSpinbox *s);
+
#endif
diff --git a/BBB_GOFILES/radiobuttons.go b/radiobuttons.go
index 2413544..7f39933 100644
--- a/BBB_GOFILES/radiobuttons.go
+++ b/radiobuttons.go
@@ -6,10 +6,7 @@ import (
"unsafe"
)
-// #include "ui.h"
-// extern void doRadioButtonsOnSelected(uiRadioButtons *, void *);
-// // see golang/go#19835
-// typedef void (*radioButtonsCallback)(uiRadioButtons *, void *);
+// #include "pkgui.h"
import "C"
// RadioButtons is a Control that represents a set of checkable
@@ -26,7 +23,7 @@ func NewRadioButtons() *RadioButtons {
r.r = C.uiNewRadioButtons()
- C.uiRadioButtonsOnSelected(r.r, C.radioButtonsCallback(C.doRadioButtonsOnSelected), nil)
+ C.pkguiRadioButtonsOnSelected(r.r)
r.ControlBase = NewControlBase(r, uintptr(unsafe.Pointer(r.r)))
return r
@@ -57,8 +54,8 @@ func (r *RadioButtons) OnSelected(f func(*RadioButtons)) {
r.onSelected = f
}
-//export doRadioButtonsOnSelected
-func doRadioButtonsOnSelected(rr *C.uiRadioButtons, data unsafe.Pointer) {
+//export pkguiDoRadioButtonsOnSelected
+func pkguiDoRadioButtonsOnSelected(rr *C.uiRadioButtons, data unsafe.Pointer) {
r := ControlFromLibui(uintptr(unsafe.Pointer(rr))).(*RadioButtons)
if r.onSelected != nil {
r.onSelected(r)
diff --git a/BBB_GOFILES/separator.go b/separator.go
index 67dea4f..f1a1249 100644
--- a/BBB_GOFILES/separator.go
+++ b/separator.go
@@ -6,7 +6,7 @@ import (
"unsafe"
)
-// #include "ui.h"
+// #include "pkgui.h"
import "C"
// Separator is a Control that represents a horizontal line that
diff --git a/BBB_GOFILES/slider.go b/slider.go
index 91656cf..19bc31b 100644
--- a/BBB_GOFILES/slider.go
+++ b/slider.go
@@ -6,10 +6,7 @@ import (
"unsafe"
)
-// #include "ui.h"
-// extern void doSliderOnChanged(uiSlider *, void *);
-// // see golang/go#19835
-// typedef void (*sliderCallback)(uiSlider *, void *);
+// #include "pkgui.h"
import "C"
// Slider is a Control that represents a horizontal bar that represents
@@ -27,7 +24,7 @@ func NewSlider(min int, max int) *Slider {
s.s = C.uiNewSlider(C.int(min), C.int(max))
- C.uiSliderOnChanged(s.s, C.sliderCallback(C.doSliderOnChanged), nil)
+ C.pkguiSliderOnChanged(s.s)
s.ControlBase = NewControlBase(s, uintptr(unsafe.Pointer(s.s)))
return s
@@ -49,8 +46,8 @@ func (s *Slider) OnChanged(f func(*Slider)) {
s.onChanged = f
}
-//export doSliderOnChanged
-func doSliderOnChanged(ss *C.uiSlider, data unsafe.Pointer) {
+//export pkguiDoSliderOnChanged
+func pkguiDoSliderOnChanged(ss *C.uiSlider, data unsafe.Pointer) {
s := ControlFromLibui(uintptr(unsafe.Pointer(ss))).(*Slider)
if s.onChanged != nil {
s.onChanged(s)
diff --git a/BBB_GOFILES/spinbox.go b/spinbox.go
index 27dd287..a7161f3 100644
--- a/BBB_GOFILES/spinbox.go
+++ b/spinbox.go
@@ -6,10 +6,7 @@ import (
"unsafe"
)
-// #include "ui.h"
-// extern void doSpinboxOnChanged(uiSpinbox *, void *);
-// // see golang/go#19835
-// typedef void (*spinboxCallback)(uiSpinbox *, void *);
+// #include "pkgui.h"
import "C"
// Spinbox is a Control that represents a space where the user can
@@ -27,7 +24,7 @@ func NewSpinbox(min int, max int) *Spinbox {
s.s = C.uiNewSpinbox(C.int(min), C.int(max))
- C.uiSpinboxOnChanged(s.s, C.spinboxCallback(C.doSpinboxOnChanged), nil)
+ C.pkguiSpinboxOnChanged(s.s)
s.ControlBase = NewControlBase(s, uintptr(unsafe.Pointer(s.s)))
return s
@@ -49,8 +46,8 @@ func (s *Spinbox) OnChanged(f func(*Spinbox)) {
s.onChanged = f
}
-//export doSpinboxOnChanged
-func doSpinboxOnChanged(ss *C.uiSpinbox, data unsafe.Pointer) {
+//export pkguiDoSpinboxOnChanged
+func pkguiDoSpinboxOnChanged(ss *C.uiSpinbox, data unsafe.Pointer) {
s := ControlFromLibui(uintptr(unsafe.Pointer(ss))).(*Spinbox)
if s.onChanged != nil {
s.onChanged(s)
diff --git a/BBB_GOFILES/tab.go b/tab.go
index 0b0b0b9..d744769 100644
--- a/BBB_GOFILES/tab.go
+++ b/tab.go
@@ -6,7 +6,7 @@ import (
"unsafe"
)
-// #include "ui.h"
+// #include "pkgui.h"
import "C"
// Tab is a Control that holds tabbed pages of Controls. Each tab