-
Notifications
You must be signed in to change notification settings - Fork 24
/
group.go
63 lines (54 loc) · 1.37 KB
/
group.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package fltk
/*
#include "group.h"
*/
import "C"
import (
"unsafe"
)
type Group struct {
widget
}
func NewGroup(x, y, w, h int, text ...string) *Group {
g := &Group{}
initWidget(g, unsafe.Pointer(C.go_fltk_new_Group(C.int(x), C.int(y), C.int(w), C.int(h), cStringOpt(text))))
return g
}
func (g *Group) Begin() {
C.go_fltk_Group_begin((*C.Fl_Group)(g.ptr()))
}
func (g *Group) End() {
C.go_fltk_Group_end((*C.Fl_Group)(g.ptr()))
}
func (g *Group) Add(w Widget) {
C.go_fltk_Group_add((*C.Fl_Group)(g.ptr()), w.getWidget().ptr())
}
func (g *Group) Remove(w Widget) {
C.go_fltk_Group_remove((*C.Fl_Group)(g.ptr()), w.getWidget().ptr())
}
func (g *Group) Resizable(w Widget) {
C.go_fltk_Group_resizable((*C.Fl_Group)(g.ptr()), w.getWidget().ptr())
}
func (g *Group) DrawChildren() {
C.go_fltk_Group_draw_children((*C.Fl_Group)(g.ptr()))
}
func (g *Group) Child(index int) *widget {
child := C.go_fltk_Group_child((*C.Fl_Group)(g.ptr()), C.int(index))
if child == nil {
return nil
}
widget := &widget{}
initUnownedWidget(widget, unsafe.Pointer(child))
return widget
}
func (g *Group) ChildCount() int {
return int(C.go_fltk_Group_child_count((*C.Fl_Group)(g.ptr())))
}
func (g *Group) Children() []*widget {
childCount := g.ChildCount()
children := make([]*widget, 0, childCount)
for i := 0; i < childCount; i++ {
children = append(children, g.Child(i))
}
return children
}