diff --git a/area.go b/area.go index 3c7ff07..211dea1 100644 --- a/area.go +++ b/area.go @@ -336,20 +336,29 @@ func (a *Area) make(window *sysData) error { return nil } -func (a *Area) setRect(x int, y int, width int, height int, rr *[]resizerequest) { - *rr = append(*rr, resizerequest{ - sysData: a.sysData, +func (a *Area) allocate(x int, y int, width int, height int, d *sysSizeData) []*allocation { + return []*allocation{&allocation{ x: x, y: y, width: width, height: height, - }) + this: a, + }} } -func (a *Area) preferredSize() (width int, height int, yoff int) { - return a.sysData.preferredSize() +func (a *Area) preferredSize(d *sysSizeData) (width int, height int) { + return a.sysData.preferredSize(d) } +func (a *Area) commitResize(a *allocation, d *sysSizeData) { + a.sysData.preferredSize(a, d) +} + +func (a *Area) getAuxResizeInfo(d *sysSizeData) { + a.sysData.getAuxResizeInfo(d) +} + + // internal function, but shared by all system implementations: &img.Pix[0] is not necessarily the first pixel in the image func pixelDataPos(img *image.RGBA) int { return img.PixOffset(img.Rect.Min.X, img.Rect.Min.Y) diff --git a/button.go b/button.go index 56d9c67..1a352dd 100644 --- a/button.go +++ b/button.go @@ -65,16 +65,24 @@ func (b *Button) make(window *sysData) error { return nil } -func (b *Button) setRect(x int, y int, width int, height int, rr *[]resizerequest) { - *rr = append(*rr, resizerequest{ - sysData: b.sysData, +func (b *Button) allocate(x int, y int, width int, height int, d *sysSizeData) []*allocation { + return []*allocation{&allocation{ x: x, y: y, width: width, height: height, - }) + this: b, + }} } -func (b *Button) preferredSize() (width int, height int, yoff int) { - return b.sysData.preferredSize() +func (b *Button) preferredSize(d *sysSizeData) (width int, height int) { + return b.sysData.preferredSize(d) +} + +func (b *Button) commitResize(a *allocation, d *sysSizeData) { + b.sysData.preferredSize(a, d) +} + +func (b *Button) getAuxResizeInfo(d *sysSizeData) { + b.sysData.getAuxResizeInfo(d) } diff --git a/checkbox.go b/checkbox.go index 71c2b77..1f2ea58 100644 --- a/checkbox.go +++ b/checkbox.go @@ -70,16 +70,24 @@ func (c *Checkbox) make(window *sysData) error { return nil } -func (c *Checkbox) setRect(x int, y int, width int, height int, rr *[]resizerequest) { - *rr = append(*rr, resizerequest{ - sysData: c.sysData, +func (c *Checkbox) allocate(x int, y int, width int, height int, d *sysSizeData) []*allocation { + return []*allocation{&allocation{ x: x, y: y, width: width, height: height, - }) + this: c, + }} } -func (c *Checkbox) preferredSize() (width int, height int, yoff int) { - return c.sysData.preferredSize() +func (c *Checkbox) preferredSize(d *sysSizeData) (width int, height int) { + return c.sysData.preferredSize(d) +} + +func (c *Checkbox) commitResize(a *allocation, d *sysSizeData) { + c.sysData.preferredSize(a, d) +} + +func (c *Checkbox) getAuxResizeInfo(d *sysSizeData) { + c.sysData.getAuxResizeInfo(d) } diff --git a/combobox.go b/combobox.go index 5fa391f..9298f87 100644 --- a/combobox.go +++ b/combobox.go @@ -147,16 +147,24 @@ func (c *Combobox) make(window *sysData) (err error) { return nil } -func (c *Combobox) setRect(x int, y int, width int, height int, rr *[]resizerequest) { - *rr = append(*rr, resizerequest{ - sysData: c.sysData, +func (c *Combobox) allocate(x int, y int, width int, height int, d *sysSizeData) []*allocation { + return []*allocation{&allocation{ x: x, y: y, width: width, height: height, - }) + this: c, + }} } -func (c *Combobox) preferredSize() (width int, height int, yoff int) { - return c.sysData.preferredSize() +func (c *Combobox) preferredSize(d *sysSizeData) (width int, height int) { + return c.sysData.preferredSize(d) +} + +func (c *Combobox) commitResize(a *allocation, d *sysSizeData) { + c.sysData.preferredSize(a, d) +} + +func (c *Combobox) getAuxResizeInfo(d *sysSizeData) { + c.sysData.getAuxResizeInfo(d) } diff --git a/label.go b/label.go index 509c980..6d9ed3b 100644 --- a/label.go +++ b/label.go @@ -74,16 +74,24 @@ func (l *Label) make(window *sysData) error { return nil } -func (l *Label) setRect(x int, y int, width int, height int, rr *[]resizerequest) { - *rr = append(*rr, resizerequest{ - sysData: l.sysData, +func (l *Label) allocate(x int, y int, width int, height int, d *sysSizeData) []*allocation { + return []*allocation{&allocation{ x: x, y: y, width: width, height: height, - }) + this: l, + }} } -func (l *Label) preferredSize() (width int, height int, yoff int) { - return l.sysData.preferredSize() +func (l *Label) preferredSize(d *sysSizeData) (width int, height int) { + return l.sysData.preferredSize(d) +} + +func (l *Label) commitResize(a *allocation, d *sysSizeData) { + l.sysData.preferredSize(a, d) +} + +func (l *Label) getAuxResizeInfo(d *sysSizeData) { + l.sysData.getAuxResizeInfo(d) } diff --git a/lineedit.go b/lineedit.go index 26fbaa1..3e71db1 100644 --- a/lineedit.go +++ b/lineedit.go @@ -68,16 +68,24 @@ func (l *LineEdit) make(window *sysData) error { return nil } -func (l *LineEdit) setRect(x int, y int, width int, height int, rr *[]resizerequest) { - *rr = append(*rr, resizerequest{ - sysData: l.sysData, +func (l *LineEdit) allocate(x int, y int, width int, height int, d *sysSizeData) []*allocation { + return []*allocation{&allocation{ x: x, y: y, width: width, height: height, - }) + this: l, + }} } -func (l *LineEdit) preferredSize() (width int, height int, yoff int) { - return l.sysData.preferredSize() +func (l *LineEdit) preferredSize(d *sysSizeData) (width int, height int) { + return l.sysData.preferredSize(d) +} + +func (l *LineEdit) commitResize(a *allocation, d *sysSizeData) { + l.sysData.preferredSize(a, d) +} + +func (l *LineEdit) getAuxResizeInfo(d *sysSizeData) { + l.sysData.getAuxResizeInfo(d) } diff --git a/listbox.go b/listbox.go index dc4cb70..cd7aab1 100644 --- a/listbox.go +++ b/listbox.go @@ -150,16 +150,24 @@ func (l *Listbox) make(window *sysData) (err error) { return nil } -func (l *Listbox) setRect(x int, y int, width int, height int, rr *[]resizerequest) { - *rr = append(*rr, resizerequest{ - sysData: l.sysData, +func (l *Listbox) allocate(x int, y int, width int, height int, d *sysSizeData) []*allocation { + return []*allocation{&allocation{ x: x, y: y, width: width, height: height, - }) + this: l, + }} } -func (l *Listbox) preferredSize() (width int, height int, yoff int) { - return l.sysData.preferredSize() +func (l *Listbox) preferredSize(d *sysSizeData) (width int, height int) { + return l.sysData.preferredSize(d) +} + +func (l *Listbox) commitResize(a *allocation, d *sysSizeData) { + l.sysData.preferredSize(a, d) +} + +func (l *Listbox) getAuxResizeInfo(d *sysSizeData) { + l.sysData.getAuxResizeInfo(d) } diff --git a/progressbar.go b/progressbar.go index 212620d..c2cd289 100644 --- a/progressbar.go +++ b/progressbar.go @@ -56,16 +56,24 @@ func (p *ProgressBar) make(window *sysData) error { return nil } -func (p *ProgressBar) setRect(x int, y int, width int, height int, rr *[]resizerequest) { - *rr = append(*rr, resizerequest{ - sysData: p.sysData, +func (p *ProgressBar) allocate(x int, y int, width int, height int, d *sysSizeData) []*allocation { + return []*allocation{&allocation{ x: x, y: y, width: width, height: height, - }) + this: p, + }} } -func (p *ProgressBar) preferredSize() (width int, height int, yoff int) { - return p.sysData.preferredSize() +func (p *ProgressBar) preferredSize(d *sysSizeData) (width int, height int) { + return p.sysData.preferredSize(d) +} + +func (p *ProgressBar) commitResize(a *allocation, d *sysSizeData) { + p.sysData.preferredSize(a, d) +} + +func (p *ProgressBar) getAuxResizeInfo(d *sysSizeData) { + p.sysData.getAuxResizeInfo(d) }