summaryrefslogtreecommitdiff
path: root/redo/sizing.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-07-25 19:28:34 -0400
committerPietro Gagliardi <[email protected]>2014-07-25 19:28:34 -0400
commit010c97d686f8e10f940c98b62ffb5a6735f73490 (patch)
tree2665df4bae7762fd2932f5449f124f29f5a804ec /redo/sizing.go
parent4680e35300544a90d5426cbf44b4c533fa025105 (diff)
Adjusted sizing data to act as the base container type; this is needed for proper resizing on both GTK+ and Mac OS X.
Diffstat (limited to 'redo/sizing.go')
-rw-r--r--redo/sizing.go27
1 files changed, 21 insertions, 6 deletions
diff --git a/redo/sizing.go b/redo/sizing.go
index a3f8c0e..5bf1e84 100644
--- a/redo/sizing.go
+++ b/redo/sizing.go
@@ -33,16 +33,31 @@ type controlSizing interface {
getAuxResizeInfo(*sizing)
}
-func (w *window) doresize(width, height int) {
- if w.child == nil { // no children; nothing to do
+// on Windows, this is only embedded by window, as all other containers cannot have their own children
+// on GTK+ and Mac OS X, one is embedded by window and all containers; the containers call container.continueResize()
+type container struct {
+ child Control
+ spaced bool
+ beginResize func() (d *sizing)
+}
+
+func (c *container) resize(width, height int) {
+ if c.child == nil { // no children; nothing to do
+ return
+ }
+ d := c.beginResize()
+ c.continueResize(width, height, d)
+}
+
+func (c *container) continueResize(width, height int, d *sizing) {
+ if c.child == nil { // no children; nothing to do
return
}
- d := w.beginResize()
- allocations := w.child.allocate(0, 0, width, height, d)
- w.translateAllocationCoords(allocations, width, height)
+ allocations := c.child.allocate(0, 0, width, height, d)
+ c.translateAllocationCoords(allocations, width, height)
// move in reverse so as to approximate right->left order so neighbors make sense
for i := len(allocations) - 1; i >= 0; i-- {
allocations[i].this.commitResize(allocations[i], d)
}
- w.endResize(d)
+ c.endResize(d)
}