Skip to content

Commit 1095719

Browse files
committed
Migrated more controls.
1 parent 2bc7621 commit 1095719

File tree

10 files changed

+46
-26
lines changed

10 files changed

+46
-26
lines changed
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ import (
66
"unsafe"
77
)
88

9-
// #include "ui.h"
10-
// extern void doComboboxOnSelected(uiCombobox *, void *);
11-
// // see golang/go#19835
12-
// typedef void (*comboboxCallback)(uiCombobox *, void *);
9+
// #include "pkgui.h"
1310
import "C"
1411

1512
// Combobox is a Control that represents a drop-down list of strings
@@ -27,7 +24,7 @@ func NewCombobox() *Combobox {
2724

2825
c.c = C.uiNewCombobox()
2926

30-
C.uiComboboxOnSelected(c.c, C.comboboxCallback(C.doComboboxOnSelected), nil)
27+
C.pkguiComboboxOnSelected(c.c)
3128

3229
c.ControlBase = NewControlBase(c, uintptr(unsafe.Pointer(c.c)))
3330
return c
@@ -58,8 +55,8 @@ func (c *Combobox) OnSelected(f func(*Combobox)) {
5855
c.onSelected = f
5956
}
6057

61-
//export doComboboxOnSelected
62-
func doComboboxOnSelected(cc *C.uiCombobox, data unsafe.Pointer) {
58+
//export pkguiDoComboboxOnSelected
59+
func pkguiDoComboboxOnSelected(cc *C.uiCombobox, data unsafe.Pointer) {
6360
c := ControlFromLibui(uintptr(unsafe.Pointer(cc))).(*Combobox)
6461
if c.onSelected != nil {
6562
c.onSelected(c)
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ import (
66
"unsafe"
77
)
88

9-
// #include "ui.h"
10-
// extern void doEditableComboboxOnChanged(uiEditableCombobox *, void *);
11-
// // see golang/go#19835
12-
// typedef void (*editableComboboxCallback)(uiEditableCombobox *, void *);
9+
// #include "pkgui.h"
1310
import "C"
1411

1512
// EditableCombobox is a Control that represents a drop-down list
@@ -27,7 +24,7 @@ func NewEditableCombobox() *EditableCombobox {
2724

2825
c.c = C.uiNewEditableCombobox()
2926

30-
C.uiEditableComboboxOnChanged(c.c, C.editableComboboxCallback(C.doEditableComboboxOnChanged), nil)
27+
C.pkguiEditableComboboxOnChanged(c.c)
3128

3229
c.ControlBase = NewControlBase(c, uintptr(unsafe.Pointer(c.c)))
3330
return c
@@ -63,8 +60,8 @@ func (e *EditableCombobox) OnChanged(f func(*EditableCombobox)) {
6360
e.onChanged = f
6461
}
6562

66-
//export doEditableComboboxOnChanged
67-
func doEditableComboboxOnChanged(cc *C.uiEditableCombobox, data unsafe.Pointer) {
63+
//export pkguiDoEditableComboboxOnChanged
64+
func pkguiDoEditableComboboxOnChanged(cc *C.uiEditableCombobox, data unsafe.Pointer) {
6865
e := ControlFromLibui(uintptr(unsafe.Pointer(cc))).(*EditableCombobox)
6966
if e.onChanged != nil {
7067
e.onChanged(e)
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ import (
1010
"unsafe"
1111
)
1212

13-
// #include "ui.h"
14-
// extern void doEntryOnChanged(uiEntry *, void *);
15-
// // see golang/go#19835
16-
// typedef void (*entryCallback)(uiEntry *, void *);
13+
// #include "pkgui.h"
1714
import "C"
1815

1916
// Entry is a Control that represents a space that the user can
@@ -29,7 +26,7 @@ func finishNewEntry(ee *C.uiEntry) *Entry {
2926

3027
e.e = ee
3128

32-
C.uiEntryOnChanged(e.e, C.entryCallback(C.doEntryOnChanged), nil)
29+
C.pkguiEntryOnChanged(e.e)
3330

3431
e.ControlBase = NewControlBase(e, uintptr(unsafe.Pointer(e.e)))
3532
return e
@@ -74,8 +71,8 @@ func (e *Entry) OnChanged(f func(*Entry)) {
7471
e.onChanged = f
7572
}
7673

77-
//export doEntryOnChanged
78-
func doEntryOnChanged(ee *C.uiEntry, data unsafe.Pointer) {
74+
//export pkguiDoEntryOnChanged
75+
func pkguiDoEntryOnChanged(ee *C.uiEntry, data unsafe.Pointer) {
7976
e := ControlFromLibui(uintptr(unsafe.Pointer(ee))).(*Entry)
8077
if e.onChanged != nil {
8178
e.onChanged(e)

BBB_GOFILES/form.go renamed to form.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"unsafe"
77
)
88

9-
// #include "ui.h"
9+
// #include "pkgui.h"
1010
import "C"
1111

1212
// Form is a Control that holds a group of Controls vertically

BBB_GOFILES/grid.go renamed to grid.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"unsafe"
77
)
88

9-
// #include "ui.h"
9+
// #include "pkgui.h"
1010
import "C"
1111

1212
// Grid is a Control that arranges other Controls in a grid.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"unsafe"
77
)
88

9-
// #include "ui.h"
9+
// #include "pkgui.h"
1010
import "C"
1111

1212
// Group is a Control that holds another Control and wraps it around
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"unsafe"
77
)
88

9-
// #include "ui.h"
9+
// #include "pkgui.h"
1010
import "C"
1111

1212
// Label is a Control that represents a line of text that cannot be

pkgui.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,18 @@ void pkguiCheckboxOnToggled(uiCheckbox *c)
3636
{
3737
uiCheckboxOnToggled(c, pkguiDoCheckboxOnToggled, NULL);
3838
}
39+
40+
void pkguiComboboxOnSelected(uiCombobox *c)
41+
{
42+
uiComboboxOnSelected(c, pkguiDoComboboxOnSelected, NULL);
43+
}
44+
45+
void pkguiEditableComboboxOnChanged(uiEditableCombobox *c)
46+
{
47+
uiEditableComboboxOnChanged(c, pkguiDoEditableComboboxOnChanged, NULL);
48+
}
49+
50+
void pkguiEntryOnChanged(uiEntry *e)
51+
{
52+
uiEntryOnChanged(e, pkguiDoEntryOnChanged, NULL);
53+
}

pkgui.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
// 12 august 2018
2+
#ifndef pkguiHFileIncluded
3+
#define pkguiHFileIncluded
4+
25
#include <stdlib.h>
36
#include "ui.h"
47

@@ -16,3 +19,14 @@ extern void pkguiButtonOnClicked(uiButton *b);
1619

1720
// checkbox.go
1821
extern void pkguiCheckboxOnToggled(uiCheckbox *c);
22+
23+
// combobox.go
24+
extern void pkguiComboboxOnSelected(uiCombobox *c);
25+
26+
// editablecombobox.go
27+
extern void pkguiEditableComboboxOnChanged(uiEditableCombobox *c);
28+
29+
// entry.go
30+
extern void pkguiEntryOnChanged(uiEntry *e);
31+
32+
#endif
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"unsafe"
77
)
88

9-
// #include "ui.h"
9+
// #include "pkgui.h"
1010
import "C"
1111

1212
// ProgressBar is a Control that represents a horizontal bar that

0 commit comments

Comments
 (0)