summaryrefslogtreecommitdiff
path: root/listbox.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-03-11 20:44:04 -0400
committerPietro Gagliardi <[email protected]>2014-03-11 20:44:04 -0400
commit1e338afc4ae366c77da230699550a8be91074fcc (patch)
treed50661f700e1232ad6d116a33df8406efa299d8c /listbox.go
parenta6188ec490f125b9eb6e6ac50637e898381c2522 (diff)
Split NewListbox() into NewListbox() (single-selection) and NewMultiSelListbox() (multiple selection); fixed the documentaiton for the Listbox constructor(s) to talk about Listbox and not Combobox, and added some TODOs.
Diffstat (limited to 'listbox.go')
-rw-r--r--listbox.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/listbox.go b/listbox.go
index 7e05287..cdb6c2d 100644
--- a/listbox.go
+++ b/listbox.go
@@ -17,8 +17,7 @@ type Listbox struct {
initItems []string
}
-// NewCombobox makes a new combobox with the given items. If multiple is true, the listbox allows multiple selection.
-func NewListbox(multiple bool, items ...string) (l *Listbox) {
+func newListbox(multiple bool, items ...string) (l *Listbox) {
l = &Listbox{
sysData: mksysdata(c_listbox),
initItems: items,
@@ -27,6 +26,16 @@ func NewListbox(multiple bool, items ...string) (l *Listbox) {
return l
}
+// NewListbox creates a new single-selection Listbox with the given items loaded initially.
+func NewListbox(items ...string) *Listbox {
+ return newListbox(false, items...)
+}
+
+// NewMultiSelListbox creates a new multiple-selection Listbox with the given items loaded initially.
+func NewMultiSelListbox(items ...string) *Listbox {
+ return newListbox(true, items...)
+}
+
// Append adds items to the end of the Listbox's list.
// Append will panic if something goes wrong on platforms that do not abort themselves.
func (l *Listbox) Append(what ...string) {