From 1e338afc4ae366c77da230699550a8be91074fcc Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Tue, 11 Mar 2014 20:44:04 -0400 Subject: 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. --- listbox.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'listbox.go') 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) { -- cgit v1.2.3