summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-02-24 10:56:35 -0500
committerPietro Gagliardi <[email protected]>2014-02-24 10:56:35 -0500
commit53db57745f2b0bdb0d6097d6d12d3d7af8f6c639 (patch)
tree38e76e5341b85e420003f3bc830d9f09faf9245f
parent1510af0005529659798e69fcd9c8f545ee0aa3e1 (diff)
Added Control.preferredSize() and preferredSize() for all the standard Controls.
-rw-r--r--button.go8
-rw-r--r--checkbox.go8
-rw-r--r--combobox.go8
-rw-r--r--control.go1
-rw-r--r--label.go8
-rw-r--r--lineedit.go8
-rw-r--r--listbox.go8
7 files changed, 49 insertions, 0 deletions
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
+}