Added Control.preferredSize() and preferredSize() for all the standard Controls.
This commit is contained in:
parent
1510af0005
commit
53db57745f
|
@ -67,3 +67,11 @@ func (b *Button) setRect(x int, y int, width int, height int) error {
|
|||
|
||||
return b.sysData.setRect(x, y, width, height)
|
||||
}
|
||||
|
||||
func (b *Button) preferredSize() (width int, height int, err error) {
|
||||
b.lock.Lock()
|
||||
defer b.lock.Unlock()
|
||||
|
||||
width, height = b.sysData.preferredSize()
|
||||
return
|
||||
}
|
||||
|
|
|
@ -74,3 +74,11 @@ func (c *Checkbox) setRect(x int, y int, width int, height int) error {
|
|||
|
||||
return c.sysData.setRect(x, y, width, height)
|
||||
}
|
||||
|
||||
func (c *Checkbox) preferredSize() (width int, height int, err error) {
|
||||
c.lock.Lock()
|
||||
defer c.lock.Unlock()
|
||||
|
||||
width, height = c.sysData.preferredSize()
|
||||
return
|
||||
}
|
||||
|
|
|
@ -110,3 +110,11 @@ func (c *Combobox) setRect(x int, y int, width int, height int) error {
|
|||
|
||||
return c.sysData.setRect(x, y, width, height)
|
||||
}
|
||||
|
||||
func (c *Combobox) preferredSize() (width int, height int, err error) {
|
||||
c.lock.Lock()
|
||||
defer c.lock.Unlock()
|
||||
|
||||
width, height = c.sysData.preferredSize()
|
||||
return
|
||||
}
|
||||
|
|
|
@ -9,4 +9,5 @@ import (
|
|||
type Control interface {
|
||||
make(window *sysData) error
|
||||
setRect(x int, y int, width int, height int) error
|
||||
preferredSize() (width int, height int, err error)
|
||||
}
|
||||
|
|
8
label.go
8
label.go
|
@ -62,3 +62,11 @@ func (l *Label) setRect(x int, y int, width int, height int) error {
|
|||
|
||||
return l.sysData.setRect(x, y, width, height)
|
||||
}
|
||||
|
||||
func (l *Label) preferredSize() (width int, height int, err error) {
|
||||
l.lock.Lock()
|
||||
defer l.lock.Unlock()
|
||||
|
||||
width, height = l.sysData.preferredSize()
|
||||
return
|
||||
}
|
||||
|
|
|
@ -64,3 +64,11 @@ func (l *LineEdit) setRect(x int, y int, width int, height int) error {
|
|||
|
||||
return l.sysData.setRect(x, y, width, height)
|
||||
}
|
||||
|
||||
func (l *LineEdit) preferredSize() (width int, height int, err error) {
|
||||
l.lock.Lock()
|
||||
defer l.lock.Unlock()
|
||||
|
||||
width, height = l.sysData.preferredSize()
|
||||
return
|
||||
}
|
||||
|
|
|
@ -110,3 +110,11 @@ func (l *Listbox) setRect(x int, y int, width int, height int) error {
|
|||
|
||||
return l.sysData.setRect(x, y, width, height)
|
||||
}
|
||||
|
||||
func (l *Listbox) preferredSize() (width int, height int, err error) {
|
||||
l.lock.Lock()
|
||||
defer l.lock.Unlock()
|
||||
|
||||
width, height = l.sysData.preferredSize()
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue