Migrated existing controls to the new sizing system.
This commit is contained in:
parent
e4992dbcb2
commit
057f0eaf53
21
area.go
21
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)
|
||||
|
|
20
button.go
20
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)
|
||||
}
|
||||
|
|
20
checkbox.go
20
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)
|
||||
}
|
||||
|
|
20
combobox.go
20
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)
|
||||
}
|
||||
|
|
20
label.go
20
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)
|
||||
}
|
||||
|
|
20
lineedit.go
20
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)
|
||||
}
|
||||
|
|
20
listbox.go
20
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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue