diff --git a/button.go b/button.go index ffbdc6d..e303ef4 100644 --- a/button.go +++ b/button.go @@ -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 +} diff --git a/checkbox.go b/checkbox.go index c57059d..4e07a0d 100644 --- a/checkbox.go +++ b/checkbox.go @@ -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 +} diff --git a/combobox.go b/combobox.go index 2f70fa8..255bcf0 100644 --- a/combobox.go +++ b/combobox.go @@ -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 +} diff --git a/control.go b/control.go index 16f94bb..1c610b1 100644 --- a/control.go +++ b/control.go @@ -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) } diff --git a/label.go b/label.go index 9dd7ac5..25cdc5d 100644 --- a/label.go +++ b/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 +} diff --git a/lineedit.go b/lineedit.go index ab05085..61f1cf7 100644 --- a/lineedit.go +++ b/lineedit.go @@ -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 +} diff --git a/listbox.go b/listbox.go index 9f87ad6..b333f79 100644 --- a/listbox.go +++ b/listbox.go @@ -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 +}