summaryrefslogtreecommitdiff
path: root/group_darwin.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-10-18 17:03:07 -0400
committerPietro Gagliardi <[email protected]>2014-10-18 17:03:07 -0400
commit62048303a34f6cac733798651adb53b640e2114a (patch)
treeb03994dfe1d5cfbc94be65075f3345a45166bbef /group_darwin.go
parent8c8b642adbed274133b6e9d975c7ca8786300d2c (diff)
Merged new container/sizing stuff.
Diffstat (limited to 'group_darwin.go')
-rw-r--r--group_darwin.go48
1 files changed, 25 insertions, 23 deletions
diff --git a/group_darwin.go b/group_darwin.go
index ad3610a..23dd563 100644
--- a/group_darwin.go
+++ b/group_darwin.go
@@ -10,49 +10,51 @@ import (
import "C"
type group struct {
- _id C.id
+ *controlSingleObject
- *container
+ child Control
+ container *container
+
+ margined bool
+
+ chainresize func(x int, y int, width int, height int, d *sizing)
}
func newGroup(text string, control Control) Group {
g := new(group)
- g.container = newContainer(control)
- g._id = C.newGroup(g.container.id)
+ g.container = newContainer()
+ g.controlSingleObject = newControlSingleObject(C.newGroup(g.container.id))
+ g.child = control
+ g.child.setParent(g.container.parent())
g.SetText(text)
+ g.chainresize = g.fresize
+ g.fresize = g.xresize
return g
}
func (g *group) Text() string {
- return C.GoString(C.groupText(g._id))
+ return C.GoString(C.groupText(g.id))
}
func (g *group) SetText(text string) {
ctext := C.CString(text)
defer C.free(unsafe.Pointer(ctext))
- C.groupSetText(g._id, ctext)
-}
-
-func (g *group) id() C.id {
- return g._id
+ C.groupSetText(g.id, ctext)
}
-func (g *group) setParent(p *controlParent) {
- basesetParent(g, p)
+func (g *group) Margined() bool {
+ return g.margined
}
-func (g *group) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
- return baseallocate(g, x, y, width, height, d)
+func (g *group) SetMargined(margined bool) {
+ g.margined = margined
}
-func (g *group) preferredSize(d *sizing) (width, height int) {
- return basepreferredSize(g, d)
-}
-
-func (g *group) commitResize(a *allocation, d *sizing) {
- basecommitResize(g, a, d)
-}
+func (g *group) xresize(x int, y int, width int, height int, d *sizing) {
+ // first, chain up to change the GtkFrame and its child container
+ g.chainresize(x, y, width, height, d)
-func (g *group) getAuxResizeInfo(d *sizing) {
- basegetAuxResizeInfo(g, d)
+ // now that the container has the correct size, we can resize the child
+ a := g.container.allocation(g.margined)
+ g.child.resize(int(a.x), int(a.y), int(a.width), int(a.height), d)
}