예제 #1
0
파일: builder.go 프로젝트: caengcjd/go-gtk
func main() {
	gtk.Init(&os.Args)
	builder := gtk.Builder()
	builder.AddFromFile("hello.ui")
	builder.ConnectSignals(nil)
	obj := builder.GetObject("window1")

	window := gtk.WidgetFromObject(obj)
	window.Show()
	window.Connect("destroy", gtk.MainQuit)

	gtk.Main()
}
예제 #2
0
파일: builder.go 프로젝트: mattn/go-gtk
//"github.com/mattn/go-gtk/example/builder/callback"
func main() {
	gtk.Init(&os.Args)

	builder := gtk.NewBuilder()

	builder.AddFromFile("hello.ui")
	obj := builder.GetObject("window1")

	window := gtk.WidgetFromObject(obj)
	window.Show()
	window.Connect("destroy", gtk.MainQuit)

	callback.Init(builder)

	gtk.Main()
}
예제 #3
0
파일: callback.go 프로젝트: mattn/go-gtk
func Init(builder *gtk.Builder) {
	aboutdialog = &gtk.AboutDialog{
		*(*gtk.Dialog)(unsafe.Pointer(&builder.GetObject("aboutdialog1").Object))}
	builder.ConnectSignalsFull(func(builder *gtk.Builder, obj *glib.GObject, sig, handler string, conn *glib.GObject, flags glib.ConnectFlags, user_data interface{}) {
		switch handler {
		case "on_imagemenuitem1_activate":
			obj.SignalConnect(sig, on_imagemenuitem1_activate, user_data, flags)
		case "on_show_aboutdialog_activate":
			obj.SignalConnect(sig, on_show_aboutdialog_activate, user_data, flags)
		case "gtk_widget_hide":
			obj.SignalConnect(sig, func(c *glib.CallbackContext) {
				gtk.WidgetFromObject(c.Target().(*glib.GObject)).Hide()
			}, nil, flags)
		}
	}, nil)
}