andlabs-ui/group_darwin.go

49 lines
906 B
Go
Raw Normal View History

2014-08-15 23:37:38 -05:00
// 16 august 2014
package ui
import (
"unsafe"
)
// #include "objc_darwin.h"
import "C"
type group struct {
2014-10-18 16:03:07 -05:00
*controlSingleObject
2014-08-15 23:37:38 -05:00
2014-10-18 16:03:07 -05:00
child Control
container *container
2014-08-15 23:37:38 -05:00
}
func newGroup(text string, control Control) Group {
g := new(group)
2014-10-18 16:03:07 -05:00
g.container = newContainer()
g.controlSingleObject = newControlSingleObject(C.newGroup(g.container.id))
g.child = control
g.child.setParent(g.container.parent())
g.container.resize = g.child.resize
2014-08-15 23:37:38 -05:00
g.SetText(text)
return g
}
func (g *group) Text() string {
2014-10-18 16:03:07 -05:00
return C.GoString(C.groupText(g.id))
2014-08-15 23:37:38 -05:00
}
func (g *group) SetText(text string) {
ctext := C.CString(text)
defer C.free(unsafe.Pointer(ctext))
2014-10-18 16:03:07 -05:00
C.groupSetText(g.id, ctext)
2014-08-15 23:37:38 -05:00
}
2014-10-18 16:03:07 -05:00
func (g *group) Margined() bool {
return g.container.margined
2014-08-15 23:37:38 -05:00
}
2014-10-18 16:03:07 -05:00
func (g *group) SetMargined(margined bool) {
g.container.margined = margined
2014-08-15 23:37:38 -05:00
}
// no need to override resize; the child container handles that for us