summaryrefslogtreecommitdiff
path: root/sysdata_unix.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-02-16 17:30:58 -0500
committerPietro Gagliardi <[email protected]>2014-02-16 17:30:58 -0500
commit7c365b39205310d042d17fcb0825e84ee19477a5 (patch)
treef58c8c42b1126e0bf16125f737d7f74c133afcd1 /sysdata_unix.go
parent1bcbce414287a9eecfd291522f4a8e2dd0c28102 (diff)
[GTK+] Added buttons. Things aren't quite being positioned properly yet though...
Diffstat (limited to 'sysdata_unix.go')
-rw-r--r--sysdata_unix.go24
1 files changed, 22 insertions, 2 deletions
diff --git a/sysdata_unix.go b/sysdata_unix.go
index 9685004..dfe3a8c 100644
--- a/sysdata_unix.go
+++ b/sysdata_unix.go
@@ -38,7 +38,18 @@ var classTypes = [nctypes]*classData{
},
},
c_button: &classData{
-// make: gtk_button_new,
+ make: gtk_button_new,
+ setText: gtk_button_set_label,
+ signals: map[string]func(*sysData) func() bool{
+ "clicked": func(w *sysData) func() bool {
+ return func() bool {
+ if w.event != nil {
+ w.event <- struct{}{}
+ }
+ return true // do not close the window
+ }
+ },
+ },
},
c_checkbox: &classData{
},
@@ -77,6 +88,14 @@ println(s.widget)
s.container = <-ret
} else {
s.container = window.container
+ uitask <- func() {
+ gtk_container_add(s.container, s.widget)
+ for signal, generator := range ct.signals {
+ g_signal_connect(s.widget, signal, generator(s))
+ }
+ ret <- nil
+ }
+ <-ret
}
err := s.setText(initText)
if err != nil {
@@ -123,7 +142,8 @@ func (s *sysData) setRect(x int, y int, width int, height int) error {
ret := make(chan struct{})
defer close(ret)
uitask <- func() {
- gtk_fixed_put(s.container, s.widget, x, y)
+println(s.ctype, x, y, width, height)
+ gtk_fixed_move(s.container, s.widget, x, y)
gtk_widget_set_size_request(s.widget, width, height)
ret <- struct{}{}
}