diff options
| author | Pietro Gagliardi <[email protected]> | 2014-02-16 23:50:54 -0500 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-02-16 23:50:54 -0500 |
| commit | 0856e953be71f13e4062c4e2ca44002ca4a68ac3 (patch) | |
| tree | e577566011b874842fef687a92e47c6f7ded6053 /sysdata_unix.go | |
| parent | 919e89ca7e4e421cac11ac292470a1f7bf4e66d8 (diff) | |
Added GTK+ listboxes... sort of. This whole thing is so broken it's funny.
Diffstat (limited to 'sysdata_unix.go')
| -rw-r--r-- | sysdata_unix.go | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/sysdata_unix.go b/sysdata_unix.go index fd15e1b..d2e6d16 100644 --- a/sysdata_unix.go +++ b/sysdata_unix.go @@ -23,7 +23,8 @@ type classData struct { append func(widget *gtkWidget, text string) insert func(widget *gtkWidget, index int, text string) selected func(widget *gtkWidget) int - // ... + selMulti func(widget *gtkWidget) []int + smtexts func(widget *gtkWidget) []string delete func(widget *gtkWidget, index int) // ... signals map[string]func(*sysData) func() bool @@ -98,6 +99,16 @@ var classTypes = [nctypes]*classData{ text: gtk_label_get_text, }, c_listbox: &classData{ + make: gListboxNewSingle, + makeAlt: gListboxNewMulti, + // TODO setText + text: gListboxText, + append: gListboxAppend, + insert: gListboxInsert, + selected: gListboxSelected, + selMulti: gListboxSelectedMulti, + smtexts: gListboxSelMultiTexts, + delete: gListboxDelete, }, } @@ -173,7 +184,9 @@ func (s *sysData) hide() error { } func (s *sysData) setText(text string) error { -if classTypes[s.ctype] == nil || classTypes[s.ctype].setText == nil { return nil } + if classTypes[s.ctype].setText == nil { // does not have concept of text + return nil + } ret := make(chan struct{}) defer close(ret) uitask <- func() { @@ -185,7 +198,6 @@ if classTypes[s.ctype] == nil || classTypes[s.ctype].setText == nil { return nil } func (s *sysData) setRect(x int, y int, width int, height int) error { -if classTypes[s.ctype] == nil || classTypes[s.ctype].make == nil { return nil } ret := make(chan struct{}) defer close(ret) uitask <- func() { @@ -207,7 +219,6 @@ func (s *sysData) isChecked() bool { } func (s *sysData) text() string { -if classTypes[s.ctype] == nil || classTypes[s.ctype].make == nil { println(s.ctype,"unsupported text()"); return "" } ret := make(chan string) defer close(ret) uitask <- func() { @@ -217,7 +228,6 @@ if classTypes[s.ctype] == nil || classTypes[s.ctype].make == nil { println(s.cty } func (s *sysData) append(what string) error { -if classTypes[s.ctype] == nil || classTypes[s.ctype].make == nil { return nil } ret := make(chan struct{}) defer close(ret) uitask <- func() { @@ -229,7 +239,6 @@ if classTypes[s.ctype] == nil || classTypes[s.ctype].make == nil { return nil } } func (s *sysData) insertBefore(what string, before int) error { -if classTypes[s.ctype] == nil || classTypes[s.ctype].make == nil { return nil } ret := make(chan struct{}) defer close(ret) uitask <- func() { @@ -241,7 +250,6 @@ if classTypes[s.ctype] == nil || classTypes[s.ctype].make == nil { return nil } } func (s *sysData) selectedIndex() int { -if classTypes[s.ctype] == nil || classTypes[s.ctype].make == nil { return -1 } ret := make(chan int) defer close(ret) uitask <- func() { @@ -251,13 +259,21 @@ if classTypes[s.ctype] == nil || classTypes[s.ctype].make == nil { return -1 } } func (s *sysData) selectedIndices() []int { - // TODO - return nil + ret := make(chan []int) + defer close(ret) + uitask <- func() { + ret <- classTypes[s.ctype].selMulti(s.widget) + } + return <-ret } func (s *sysData) selectedTexts() []string { - // TODO - return nil + ret := make(chan []string) + defer close(ret) + uitask <- func() { + ret <- classTypes[s.ctype].smtexts(s.widget) + } + return <-ret } func (s *sysData) setWindowSize(width int, height int) error { @@ -272,7 +288,6 @@ func (s *sysData) setWindowSize(width int, height int) error { } func (s *sysData) delete(index int) error { -if classTypes[s.ctype] == nil || classTypes[s.ctype].make == nil { return nil } ret := make(chan struct{}) defer close(ret) uitask <- func() { |
