1
0
Fork 0
mirror of https://github.com/vbatts/imgsrv.git synced 2024-12-25 23:36:30 +00:00

fiddling with the buttons. i'm new to gui things...

This commit is contained in:
Vincent Batts 2013-05-10 15:26:14 -04:00
parent b224170a82
commit cdd487f86a

View file

@ -6,8 +6,10 @@ import (
"github.com/ziutek/gtk"
)
// this happens when the X is clicked (to close the app)
func cbDelete(w *gtk.Widget, ev *gdk.Event) bool {
fmt.Println("Delete")
defer gtk.MainQuit()
return true
}
@ -23,10 +25,14 @@ func main() {
w.SetBorderWidth(10)
w.Show()
a := A{"Hello World!\n"}
f := gtk.NewFileChooserButton("Select File", gtk.FILE_CHOOSER_ACTION_OPEN)
w.Add(f.AsWidget())
f.Show()
b := gtk.NewButtonWithLabel("Hello World")
b.Connect("clicked", (*A).Hello, &a)
a := Action{"Hello World!\n"}
b := gtk.NewButtonWithLabel("Quit")
b.Connect("clicked", (*Action).Quit, &a)
b.ConnectNoi("clicked", (*gtk.Widget).Destroy, w.AsWidget())
w.Add(b.AsWidget())
b.Show()
@ -34,10 +40,10 @@ func main() {
gtk.Main()
}
type A struct {
type Action struct {
s string
}
func (a *A) Hello(w *gtk.Widget) {
func (a *Action) Quit(w *gtk.Widget) {
fmt.Printf(a.s)
}