Esempio n. 1
0
// InsertAt adds the given page to the Tab such that it is the
// nth page of the Tab (starting at 0).
func (t *Tab) InsertAt(name string, n int, child Control) {
	c := (*C.uiControl)(nil)
	if child != nil {
		c = touiControl(child.LibuiControl())
	}
	cname := C.CString(name)
	// TODO why is this uintmax_t and not intmax_t
	C.uiTabInsertAt(t.t, cname, C.uintmax_t(n), c)
	freestr(cname)
	ch := make([]Control, len(t.children)+1)
	// and insert into t.children at the right place
	copy(ch[:n], t.children[:n])
	ch[n] = child
	copy(ch[n+1:], t.children[n:])
	t.children = ch
}
Esempio n. 2
0
File: draw.go Progetto: sjn1978/ui
// Family returns the name of the nth family in the list.
func (f *FontFamilies) Family(n int) string {
	cname := C.uiDrawFontFamiliesFamily(f.ff, C.uintmax_t(n))
	name := C.GoString(cname)
	C.uiFreeText(cname)
	return name
}
Esempio n. 3
0
// Delete deletes the nth control of the Box.
func (b *Box) Delete(n int) {
	b.children = append(b.children[:n], b.children[n+1:]...)
	// TODO why is this uintmax_t instead of intmax_t
	C.uiBoxDelete(b.b, C.uintmax_t(n))
}
Esempio n. 4
0
// SetMargined controls whether page n (starting at 0) of the Tab
// has margins around its child. The size of the margins are
// determined by the OS and its best practices.
func (t *Tab) SetMargined(n int, margined bool) {
	C.uiTabSetMargined(t.t, C.uintmax_t(n), frombool(margined))
}
Esempio n. 5
0
// Margined returns whether page n (starting at 0) of the Tab
// has margins around its child.
func (t *Tab) Margined(n int) bool {
	return tobool(C.uiTabMargined(t.t, C.uintmax_t(n)))
}
Esempio n. 6
0
// Delete deletes the nth page of the Tab.
func (t *Tab) Delete(n int) {
	t.children = append(t.children[:n], t.children[n+1:]...)
	C.uiTabDelete(t.t, C.uintmax_t(n))
}