summaryrefslogtreecommitdiff
path: root/listbox.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-03-08 16:42:57 -0500
committerPietro Gagliardi <[email protected]>2014-03-08 16:42:57 -0500
commit3aa59d4ab9d1217fa47c4b1b265fd435547ed62f (patch)
treebdffbdb57872231213018a6e1df732bcc0687067 /listbox.go
parentd9b0bd3c700f7c559757834f7463410cfafd6c1e (diff)
Added Combobox/Listbox.Len() and its GTK+ implementation.
Diffstat (limited to 'listbox.go')
-rw-r--r--listbox.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/listbox.go b/listbox.go
index e95b5cf..66ff398 100644
--- a/listbox.go
+++ b/listbox.go
@@ -96,6 +96,19 @@ func (l *Listbox) SelectedIndices() []int {
return nil
}
+// Len returns the number of items in the Listbox.
+//
+// On platforms for which this function may return an error, it panics if one is returned.
+func (l *Listbox) Len() int {
+ l.lock.Lock()
+ defer l.lock.Unlock()
+
+ if l.created {
+ return l.sysData.len()
+ }
+ return len(l.initItems)
+}
+
func (l *Listbox) make(window *sysData) (err error) {
l.lock.Lock()
defer l.lock.Unlock()