More control migration. Everything beyond this point is nontrivial.
This commit is contained in:
parent
1095719d84
commit
7b7ae9d7ce
|
@ -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)
|
20
pkgui.c
20
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);
|
||||
}
|
||||
|
|
12
pkgui.h
12
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
|
||||
|
|
|
@ -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)
|
|
@ -6,7 +6,7 @@ import (
|
|||
"unsafe"
|
||||
)
|
||||
|
||||
// #include "ui.h"
|
||||
// #include "pkgui.h"
|
||||
import "C"
|
||||
|
||||
// Separator is a Control that represents a horizontal line that
|
|
@ -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)
|
|
@ -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)
|
|
@ -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
|
Loading…
Reference in New Issue