summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-02-16 18:41:29 -0500
committerPietro Gagliardi <[email protected]>2014-02-16 18:41:29 -0500
commit4fc3cb1d0055706c4d62d61a165779a71e6fa2fd (patch)
tree9deabe1f85ff7b97fc6233c8f27c77247b06a785
parentb8f7f4aa6e7d0761c731c1f116b7b8f7a8c19b9a (diff)
Added Checkbox to GTK+. Also added a TODO about crashes.
-rw-r--r--gtkcalls_unix.go8
-rw-r--r--sysdata_unix.go10
-rw-r--r--todo.md2
3 files changed, 18 insertions, 2 deletions
diff --git a/gtkcalls_unix.go b/gtkcalls_unix.go
index 115060c..aba4732 100644
--- a/gtkcalls_unix.go
+++ b/gtkcalls_unix.go
@@ -114,3 +114,11 @@ func gtk_button_set_label(button *gtkWidget, label string) {
C.gtk_button_set_label((*C.GtkButton)(unsafe.Pointer(button)),
(*C.gchar)(unsafe.Pointer(clabel)))
}
+
+func gtk_check_button_new() *gtkWidget {
+ return (*gtkWidget)(unsafe.Pointer(C.gtk_check_button_new()))
+}
+
+func gtk_toggle_button_get_active(widget *gtkWidget) bool {
+ return fromgbool(C.gtk_toggle_button_get_active((*C.GtkToggleButton)(unsafe.Pointer(widget))))
+}
diff --git a/sysdata_unix.go b/sysdata_unix.go
index bf6ce49..f2aef50 100644
--- a/sysdata_unix.go
+++ b/sysdata_unix.go
@@ -65,6 +65,8 @@ var classTypes = [nctypes]*classData{
},
},
c_checkbox: &classData{
+ make: gtk_check_button_new,
+ setText: gtk_button_set_label,
},
c_combobox: &classData{
},
@@ -165,8 +167,12 @@ if classTypes[s.ctype] == nil || classTypes[s.ctype].setText == nil { return nil
}
func (s *sysData) isChecked() bool {
- // TODO
- return false
+ ret := make(chan bool)
+ defer close(ret)
+ uitask <- func() {
+ ret <- gtk_toggle_button_get_active(s.widget)
+ }
+ return <-ret
}
func (s *sysData) text() string {
diff --git a/todo.md b/todo.md
index 1c54382..e7622ef 100644
--- a/todo.md
+++ b/todo.md
@@ -28,6 +28,8 @@ super ultra important things:
- 64-bit doesn't work, period: it crashes in malloc in wine with heap corruption warnings aplenty during DLL loading; in windows 7 CreateWindowExW complains about an unregistered window class, yet the RegisterClassW appears to have succeeded and examining the stack in WinDbg indicates the correct class name is being sent (see below)
- 32-bit: it works now, but if I save the class name converted to UTF-16 beforehand, wine indicates that the class name is replaced with the window title, so something there is wrong...
- handle in-library panics (internal errors) by reporting them to the user
+- david wendt is telling me he's getting frequent crashes on his end with the GTK+ amd64 build...
+ - I get soft deadlock if I mash the Click Me button repeatedly
important things:
- maybe make it so sysData doesn't need specialized info on every control type?