-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbox.go
96 lines (79 loc) · 1.43 KB
/
box.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
package gtk
/*
#include <gtk/gtk.h>
*/
import "C"
import (
"github.com/ziutek/glib"
)
type Box struct {
Container
}
func (b *Box) g() *C.GtkBox {
return (*C.GtkBox)(b.GetPtr())
}
func (b *Box) AsBox() *Box {
return b
}
func (b *Box) PackStart(child *Widget, expand, fill bool, padding uint) {
var e, f C.gboolean
if expand {
e = 1
}
if fill {
f = 1
}
C.gtk_box_pack_start(b.g(), child.g(), e, f, C.guint(padding))
}
func (b *Box) PackEnd(child *Widget, expand, fill bool, padding uint) {
var e, f C.gboolean
if expand {
e = 1
}
if fill {
f = 1
}
C.gtk_box_pack_end(b.g(), child.g(), e, f, C.guint(padding))
}
func (b *Box) SetSpecing(spacing int) {
C.gtk_box_set_spacing(b.g(), C.gint(spacing))
}
func (b *Box) GetSpecing() int {
return int(C.gtk_box_get_spacing(b.g()))
}
type VBox struct {
Box
}
func (b *VBox) g() *C.GtkVBox {
return (*C.GtkVBox)(b.GetPtr())
}
func (b *VBox) AsVBox() *VBox {
return b
}
func NewVBox(homogeneous bool, spacing int) *VBox {
b := new(VBox)
var h C.gboolean
if homogeneous {
h = 1
}
b.SetPtr(glib.Pointer(C.gtk_vbox_new(h, C.gint(spacing))))
return b
}
type HBox struct {
Box
}
func (b *HBox) g() *C.GtkHBox {
return (*C.GtkHBox)(b.GetPtr())
}
func (b *HBox) AsHBox() *HBox {
return b
}
func NewHBox(homogeneous bool, spacing int) *HBox {
b := new(HBox)
var h C.gboolean
if homogeneous {
h = 1
}
b.SetPtr(glib.Pointer(C.gtk_hbox_new(h, C.gint(spacing))))
return b
}