Exemplo n.º 1
0
Arquivo: button.go Projeto: ziutek/gtk
func NewButtonWithLabel(label string) *Button {
	b := new(Button)
	b.SetPtr(
		glib.Pointer(C.gtk_button_new_with_label((*C.gchar)(C.CString(label)))),
	)
	return b
}
Exemplo n.º 2
0
func NewButtonWithLabel(label string) *Button {
	b := &Button{}
	l := gobject.GString(label)
	o := C.gtk_button_new_with_label((*C.gchar)(l.GetPtr()))
	b.Container = NewContainer(unsafe.Pointer(o))
	b.object = C.to_GtkButton(unsafe.Pointer(o))
	return b
}
Exemplo n.º 3
0
func NewButtonWithLabel(s string) *Button {
	l := _GString(s)
	defer _GFree(unsafe.Pointer(l))
	bt := C.gtk_button_new_with_label(l)
	if bt == nil {
		return nil
	}
	return ToButton(unsafe.Pointer(bt))
}
Exemplo n.º 4
0
// shared code for setting up buttons, check boxes, etc.
func newButton(text string) *button {
	ctext := togstr(text)
	defer freegstr(ctext)
	widget := C.gtk_button_new_with_label(ctext)
	b := &button{
		controlSingleWidget: newControlSingleWidget(widget),
		button:              (*C.GtkButton)(unsafe.Pointer(widget)),
		clicked:             newEvent(),
	}
	g_signal_connect(
		C.gpointer(unsafe.Pointer(b.button)),
		"clicked",
		C.GCallback(C.buttonClicked),
		C.gpointer(unsafe.Pointer(b)))
	return b
}