More control migration. Everything beyond this point is nontrivial.
This commit is contained in:
parent
1095719d84
commit
7b7ae9d7ce
|
@ -10,10 +10,7 @@ import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
// #include "ui.h"
|
// #include "pkgui.h"
|
||||||
// extern void doMultilineEntryOnChanged(uiMultilineEntry *, void *);
|
|
||||||
// // see golang/go#19835
|
|
||||||
// typedef void (*multilineEntryCallback)(uiMultilineEntry *, void *);
|
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
// MultilineEntry is a Control that represents a space that the user
|
// MultilineEntry is a Control that represents a space that the user
|
||||||
|
@ -29,7 +26,7 @@ func finishNewMultilineEntry(ee *C.uiMultilineEntry) *MultilineEntry {
|
||||||
|
|
||||||
m.e = ee
|
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)))
|
m.ControlBase = NewControlBase(m, uintptr(unsafe.Pointer(m.e)))
|
||||||
return m
|
return m
|
||||||
|
@ -78,8 +75,8 @@ func (m *MultilineEntry) OnChanged(f func(*MultilineEntry)) {
|
||||||
m.onChanged = f
|
m.onChanged = f
|
||||||
}
|
}
|
||||||
|
|
||||||
//export doMultilineEntryOnChanged
|
//export pkguiDoMultilineEntryOnChanged
|
||||||
func doMultilineEntryOnChanged(ee *C.uiMultilineEntry, data unsafe.Pointer) {
|
func pkguiDoMultilineEntryOnChanged(ee *C.uiMultilineEntry, data unsafe.Pointer) {
|
||||||
m := ControlFromLibui(uintptr(unsafe.Pointer(ee))).(*MultilineEntry)
|
m := ControlFromLibui(uintptr(unsafe.Pointer(ee))).(*MultilineEntry)
|
||||||
if m.onChanged != nil {
|
if m.onChanged != nil {
|
||||||
m.onChanged(m)
|
m.onChanged(m)
|
20
pkgui.c
20
pkgui.c
|
@ -51,3 +51,23 @@ void pkguiEntryOnChanged(uiEntry *e)
|
||||||
{
|
{
|
||||||
uiEntryOnChanged(e, pkguiDoEntryOnChanged, NULL);
|
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);
|
||||||
|
}
|
||||||
|
|
12
pkgui.h
12
pkgui.h
|
@ -29,4 +29,16 @@ extern void pkguiEditableComboboxOnChanged(uiEditableCombobox *c);
|
||||||
// entry.go
|
// entry.go
|
||||||
extern void pkguiEntryOnChanged(uiEntry *e);
|
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
|
#endif
|
||||||
|
|
|
@ -6,10 +6,7 @@ import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
// #include "ui.h"
|
// #include "pkgui.h"
|
||||||
// extern void doRadioButtonsOnSelected(uiRadioButtons *, void *);
|
|
||||||
// // see golang/go#19835
|
|
||||||
// typedef void (*radioButtonsCallback)(uiRadioButtons *, void *);
|
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
// RadioButtons is a Control that represents a set of checkable
|
// RadioButtons is a Control that represents a set of checkable
|
||||||
|
@ -26,7 +23,7 @@ func NewRadioButtons() *RadioButtons {
|
||||||
|
|
||||||
r.r = C.uiNewRadioButtons()
|
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)))
|
r.ControlBase = NewControlBase(r, uintptr(unsafe.Pointer(r.r)))
|
||||||
return r
|
return r
|
||||||
|
@ -57,8 +54,8 @@ func (r *RadioButtons) OnSelected(f func(*RadioButtons)) {
|
||||||
r.onSelected = f
|
r.onSelected = f
|
||||||
}
|
}
|
||||||
|
|
||||||
//export doRadioButtonsOnSelected
|
//export pkguiDoRadioButtonsOnSelected
|
||||||
func doRadioButtonsOnSelected(rr *C.uiRadioButtons, data unsafe.Pointer) {
|
func pkguiDoRadioButtonsOnSelected(rr *C.uiRadioButtons, data unsafe.Pointer) {
|
||||||
r := ControlFromLibui(uintptr(unsafe.Pointer(rr))).(*RadioButtons)
|
r := ControlFromLibui(uintptr(unsafe.Pointer(rr))).(*RadioButtons)
|
||||||
if r.onSelected != nil {
|
if r.onSelected != nil {
|
||||||
r.onSelected(r)
|
r.onSelected(r)
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
// #include "ui.h"
|
// #include "pkgui.h"
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
// Separator is a Control that represents a horizontal line that
|
// Separator is a Control that represents a horizontal line that
|
|
@ -6,10 +6,7 @@ import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
// #include "ui.h"
|
// #include "pkgui.h"
|
||||||
// extern void doSliderOnChanged(uiSlider *, void *);
|
|
||||||
// // see golang/go#19835
|
|
||||||
// typedef void (*sliderCallback)(uiSlider *, void *);
|
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
// Slider is a Control that represents a horizontal bar that represents
|
// 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))
|
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)))
|
s.ControlBase = NewControlBase(s, uintptr(unsafe.Pointer(s.s)))
|
||||||
return s
|
return s
|
||||||
|
@ -49,8 +46,8 @@ func (s *Slider) OnChanged(f func(*Slider)) {
|
||||||
s.onChanged = f
|
s.onChanged = f
|
||||||
}
|
}
|
||||||
|
|
||||||
//export doSliderOnChanged
|
//export pkguiDoSliderOnChanged
|
||||||
func doSliderOnChanged(ss *C.uiSlider, data unsafe.Pointer) {
|
func pkguiDoSliderOnChanged(ss *C.uiSlider, data unsafe.Pointer) {
|
||||||
s := ControlFromLibui(uintptr(unsafe.Pointer(ss))).(*Slider)
|
s := ControlFromLibui(uintptr(unsafe.Pointer(ss))).(*Slider)
|
||||||
if s.onChanged != nil {
|
if s.onChanged != nil {
|
||||||
s.onChanged(s)
|
s.onChanged(s)
|
|
@ -6,10 +6,7 @@ import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
// #include "ui.h"
|
// #include "pkgui.h"
|
||||||
// extern void doSpinboxOnChanged(uiSpinbox *, void *);
|
|
||||||
// // see golang/go#19835
|
|
||||||
// typedef void (*spinboxCallback)(uiSpinbox *, void *);
|
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
// Spinbox is a Control that represents a space where the user can
|
// 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))
|
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)))
|
s.ControlBase = NewControlBase(s, uintptr(unsafe.Pointer(s.s)))
|
||||||
return s
|
return s
|
||||||
|
@ -49,8 +46,8 @@ func (s *Spinbox) OnChanged(f func(*Spinbox)) {
|
||||||
s.onChanged = f
|
s.onChanged = f
|
||||||
}
|
}
|
||||||
|
|
||||||
//export doSpinboxOnChanged
|
//export pkguiDoSpinboxOnChanged
|
||||||
func doSpinboxOnChanged(ss *C.uiSpinbox, data unsafe.Pointer) {
|
func pkguiDoSpinboxOnChanged(ss *C.uiSpinbox, data unsafe.Pointer) {
|
||||||
s := ControlFromLibui(uintptr(unsafe.Pointer(ss))).(*Spinbox)
|
s := ControlFromLibui(uintptr(unsafe.Pointer(ss))).(*Spinbox)
|
||||||
if s.onChanged != nil {
|
if s.onChanged != nil {
|
||||||
s.onChanged(s)
|
s.onChanged(s)
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
// #include "ui.h"
|
// #include "pkgui.h"
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
// Tab is a Control that holds tabbed pages of Controls. Each tab
|
// Tab is a Control that holds tabbed pages of Controls. Each tab
|
Loading…
Reference in New Issue