コード例 #1
0
ファイル: button.go プロジェクト: 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
}
コード例 #2
0
ファイル: button.go プロジェクト: napsy/go-gtk3
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
}
コード例 #3
0
ファイル: button.go プロジェクト: hwch/go-gtk
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))
}
コード例 #4
0
ファイル: button_unix.go プロジェクト: sjn1978/ui
// 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
}