Migrated more controls.
This commit is contained in:
parent
2bc7621928
commit
1095719d84
|
@ -6,10 +6,7 @@ import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
// #include "ui.h"
|
// #include "pkgui.h"
|
||||||
// extern void doComboboxOnSelected(uiCombobox *, void *);
|
|
||||||
// // see golang/go#19835
|
|
||||||
// typedef void (*comboboxCallback)(uiCombobox *, void *);
|
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
// Combobox is a Control that represents a drop-down list of strings
|
// Combobox is a Control that represents a drop-down list of strings
|
||||||
|
@ -27,7 +24,7 @@ func NewCombobox() *Combobox {
|
||||||
|
|
||||||
c.c = C.uiNewCombobox()
|
c.c = C.uiNewCombobox()
|
||||||
|
|
||||||
C.uiComboboxOnSelected(c.c, C.comboboxCallback(C.doComboboxOnSelected), nil)
|
C.pkguiComboboxOnSelected(c.c)
|
||||||
|
|
||||||
c.ControlBase = NewControlBase(c, uintptr(unsafe.Pointer(c.c)))
|
c.ControlBase = NewControlBase(c, uintptr(unsafe.Pointer(c.c)))
|
||||||
return c
|
return c
|
||||||
|
@ -58,8 +55,8 @@ func (c *Combobox) OnSelected(f func(*Combobox)) {
|
||||||
c.onSelected = f
|
c.onSelected = f
|
||||||
}
|
}
|
||||||
|
|
||||||
//export doComboboxOnSelected
|
//export pkguiDoComboboxOnSelected
|
||||||
func doComboboxOnSelected(cc *C.uiCombobox, data unsafe.Pointer) {
|
func pkguiDoComboboxOnSelected(cc *C.uiCombobox, data unsafe.Pointer) {
|
||||||
c := ControlFromLibui(uintptr(unsafe.Pointer(cc))).(*Combobox)
|
c := ControlFromLibui(uintptr(unsafe.Pointer(cc))).(*Combobox)
|
||||||
if c.onSelected != nil {
|
if c.onSelected != nil {
|
||||||
c.onSelected(c)
|
c.onSelected(c)
|
|
@ -6,10 +6,7 @@ import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
// #include "ui.h"
|
// #include "pkgui.h"
|
||||||
// extern void doEditableComboboxOnChanged(uiEditableCombobox *, void *);
|
|
||||||
// // see golang/go#19835
|
|
||||||
// typedef void (*editableComboboxCallback)(uiEditableCombobox *, void *);
|
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
// EditableCombobox is a Control that represents a drop-down list
|
// EditableCombobox is a Control that represents a drop-down list
|
||||||
|
@ -27,7 +24,7 @@ func NewEditableCombobox() *EditableCombobox {
|
||||||
|
|
||||||
c.c = C.uiNewEditableCombobox()
|
c.c = C.uiNewEditableCombobox()
|
||||||
|
|
||||||
C.uiEditableComboboxOnChanged(c.c, C.editableComboboxCallback(C.doEditableComboboxOnChanged), nil)
|
C.pkguiEditableComboboxOnChanged(c.c)
|
||||||
|
|
||||||
c.ControlBase = NewControlBase(c, uintptr(unsafe.Pointer(c.c)))
|
c.ControlBase = NewControlBase(c, uintptr(unsafe.Pointer(c.c)))
|
||||||
return c
|
return c
|
||||||
|
@ -63,8 +60,8 @@ func (e *EditableCombobox) OnChanged(f func(*EditableCombobox)) {
|
||||||
e.onChanged = f
|
e.onChanged = f
|
||||||
}
|
}
|
||||||
|
|
||||||
//export doEditableComboboxOnChanged
|
//export pkguiDoEditableComboboxOnChanged
|
||||||
func doEditableComboboxOnChanged(cc *C.uiEditableCombobox, data unsafe.Pointer) {
|
func pkguiDoEditableComboboxOnChanged(cc *C.uiEditableCombobox, data unsafe.Pointer) {
|
||||||
e := ControlFromLibui(uintptr(unsafe.Pointer(cc))).(*EditableCombobox)
|
e := ControlFromLibui(uintptr(unsafe.Pointer(cc))).(*EditableCombobox)
|
||||||
if e.onChanged != nil {
|
if e.onChanged != nil {
|
||||||
e.onChanged(e)
|
e.onChanged(e)
|
|
@ -10,10 +10,7 @@ import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
// #include "ui.h"
|
// #include "pkgui.h"
|
||||||
// extern void doEntryOnChanged(uiEntry *, void *);
|
|
||||||
// // see golang/go#19835
|
|
||||||
// typedef void (*entryCallback)(uiEntry *, void *);
|
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
// Entry is a Control that represents a space that the user can
|
// Entry is a Control that represents a space that the user can
|
||||||
|
@ -29,7 +26,7 @@ func finishNewEntry(ee *C.uiEntry) *Entry {
|
||||||
|
|
||||||
e.e = ee
|
e.e = ee
|
||||||
|
|
||||||
C.uiEntryOnChanged(e.e, C.entryCallback(C.doEntryOnChanged), nil)
|
C.pkguiEntryOnChanged(e.e)
|
||||||
|
|
||||||
e.ControlBase = NewControlBase(e, uintptr(unsafe.Pointer(e.e)))
|
e.ControlBase = NewControlBase(e, uintptr(unsafe.Pointer(e.e)))
|
||||||
return e
|
return e
|
||||||
|
@ -74,8 +71,8 @@ func (e *Entry) OnChanged(f func(*Entry)) {
|
||||||
e.onChanged = f
|
e.onChanged = f
|
||||||
}
|
}
|
||||||
|
|
||||||
//export doEntryOnChanged
|
//export pkguiDoEntryOnChanged
|
||||||
func doEntryOnChanged(ee *C.uiEntry, data unsafe.Pointer) {
|
func pkguiDoEntryOnChanged(ee *C.uiEntry, data unsafe.Pointer) {
|
||||||
e := ControlFromLibui(uintptr(unsafe.Pointer(ee))).(*Entry)
|
e := ControlFromLibui(uintptr(unsafe.Pointer(ee))).(*Entry)
|
||||||
if e.onChanged != nil {
|
if e.onChanged != nil {
|
||||||
e.onChanged(e)
|
e.onChanged(e)
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
// #include "ui.h"
|
// #include "pkgui.h"
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
// Form is a Control that holds a group of Controls vertically
|
// Form is a Control that holds a group of Controls vertically
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
// #include "ui.h"
|
// #include "pkgui.h"
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
// Grid is a Control that arranges other Controls in a grid.
|
// Grid is a Control that arranges other Controls in a grid.
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
// #include "ui.h"
|
// #include "pkgui.h"
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
// Group is a Control that holds another Control and wraps it around
|
// Group is a Control that holds another Control and wraps it around
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
// #include "ui.h"
|
// #include "pkgui.h"
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
// Label is a Control that represents a line of text that cannot be
|
// Label is a Control that represents a line of text that cannot be
|
15
pkgui.c
15
pkgui.c
|
@ -36,3 +36,18 @@ void pkguiCheckboxOnToggled(uiCheckbox *c)
|
||||||
{
|
{
|
||||||
uiCheckboxOnToggled(c, pkguiDoCheckboxOnToggled, NULL);
|
uiCheckboxOnToggled(c, pkguiDoCheckboxOnToggled, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pkguiComboboxOnSelected(uiCombobox *c)
|
||||||
|
{
|
||||||
|
uiComboboxOnSelected(c, pkguiDoComboboxOnSelected, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void pkguiEditableComboboxOnChanged(uiEditableCombobox *c)
|
||||||
|
{
|
||||||
|
uiEditableComboboxOnChanged(c, pkguiDoEditableComboboxOnChanged, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void pkguiEntryOnChanged(uiEntry *e)
|
||||||
|
{
|
||||||
|
uiEntryOnChanged(e, pkguiDoEntryOnChanged, NULL);
|
||||||
|
}
|
||||||
|
|
14
pkgui.h
14
pkgui.h
|
@ -1,4 +1,7 @@
|
||||||
// 12 august 2018
|
// 12 august 2018
|
||||||
|
#ifndef pkguiHFileIncluded
|
||||||
|
#define pkguiHFileIncluded
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
|
|
||||||
|
@ -16,3 +19,14 @@ extern void pkguiButtonOnClicked(uiButton *b);
|
||||||
|
|
||||||
// checkbox.go
|
// checkbox.go
|
||||||
extern void pkguiCheckboxOnToggled(uiCheckbox *c);
|
extern void pkguiCheckboxOnToggled(uiCheckbox *c);
|
||||||
|
|
||||||
|
// combobox.go
|
||||||
|
extern void pkguiComboboxOnSelected(uiCombobox *c);
|
||||||
|
|
||||||
|
// editablecombobox.go
|
||||||
|
extern void pkguiEditableComboboxOnChanged(uiEditableCombobox *c);
|
||||||
|
|
||||||
|
// entry.go
|
||||||
|
extern void pkguiEntryOnChanged(uiEntry *e);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
// #include "ui.h"
|
// #include "pkgui.h"
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
// ProgressBar is a Control that represents a horizontal bar that
|
// ProgressBar is a Control that represents a horizontal bar that
|
Loading…
Reference in New Issue