// ImageNewFromStock is a wrapper around gtk_image_new_from_stock().
func ImageNewFromStock(stock Stock, size IconSize) (*Image, error) {
	cstr := C.CString(string(stock))
	defer C.free(unsafe.Pointer(cstr))
	c := C.gtk_image_new_from_stock((*C.gchar)(cstr), C.GtkIconSize(size))
	if c == nil {
		return nil, nilPtrErr
	}
	return wrapImage(wrapObject(unsafe.Pointer(c))), nil
}
示例#2
0
// ButtonNewFromIconName is a wrapper around gtk_button_new_from_icon_name().
func ButtonNewFromIconName(iconName string, size IconSize) (*Button, error) {
	cstr := C.CString(iconName)
	defer C.free(unsafe.Pointer(cstr))
	c := C.gtk_button_new_from_icon_name((*C.gchar)(cstr),
		C.GtkIconSize(size))
	if c == nil {
		return nil, nilPtrErr
	}
	return wrapButton(wrapObject(unsafe.Pointer(c))), nil
}
示例#3
0
// ImageNewFromStock is a wrapper around gtk_image_new_from_stock().
func ImageNewFromStock(stock Stock, size IconSize) (*Image, error) {
	cstr := C.CString(string(stock))
	defer C.free(unsafe.Pointer(cstr))
	c := C.gtk_image_new_from_stock((*C.gchar)(cstr), C.GtkIconSize(size))
	if c == nil {
		return nil, nilPtrErr
	}
	obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))}
	i := wrapImage(obj)
	obj.RefSink()
	runtime.SetFinalizer(obj, (*glib.Object).Unref)
	return i, nil
}
示例#4
0
文件: gtk_3_10.go 项目: vvanpo/gotk3
// ButtonNewFromIconName is a wrapper around gtk_button_new_from_icon_name().
func ButtonNewFromIconName(iconName string, size IconSize) (*Button, error) {
	cstr := C.CString(iconName)
	defer C.free(unsafe.Pointer(cstr))
	c := C.gtk_button_new_from_icon_name((*C.gchar)(cstr),
		C.GtkIconSize(size))
	if c == nil {
		return nil, nilPtrErr
	}
	obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))}
	b := wrapButton(obj)
	obj.RefSink()
	runtime.SetFinalizer(obj, (*glib.Object).Unref)
	return b, nil
}
示例#5
0
// SetFromStock is a wrapper around gtk_image_set_from_stock().
func (v *Image) SetFromStock(stock Stock, size IconSize) {
	cstr := C.CString(string(stock))
	defer C.free(unsafe.Pointer(cstr))
	C.gtk_image_set_from_stock(v.Native(), (*C.gchar)(cstr),
		C.GtkIconSize(size))
}
示例#6
0
文件: gtk_enums.go 项目: reusee/ggir
	FILE_CHOOSER_ERROR_BAD_FILENAME        = C.GtkFileChooserError(C.GTK_FILE_CHOOSER_ERROR_BAD_FILENAME)
	FILE_CHOOSER_ERROR_ALREADY_EXISTS      = C.GtkFileChooserError(C.GTK_FILE_CHOOSER_ERROR_ALREADY_EXISTS)
	FILE_CHOOSER_ERROR_INCOMPLETE_HOSTNAME = C.GtkFileChooserError(C.GTK_FILE_CHOOSER_ERROR_INCOMPLETE_HOSTNAME)

	// IMPreeditStyle
	IM_PREEDIT_NOTHING  = C.GtkIMPreeditStyle(C.GTK_IM_PREEDIT_NOTHING)
	IM_PREEDIT_CALLBACK = C.GtkIMPreeditStyle(C.GTK_IM_PREEDIT_CALLBACK)
	IM_PREEDIT_NONE     = C.GtkIMPreeditStyle(C.GTK_IM_PREEDIT_NONE)

	// IMStatusStyle
	IM_STATUS_NOTHING  = C.GtkIMStatusStyle(C.GTK_IM_STATUS_NOTHING)
	IM_STATUS_CALLBACK = C.GtkIMStatusStyle(C.GTK_IM_STATUS_CALLBACK)
	IM_STATUS_NONE     = C.GtkIMStatusStyle(C.GTK_IM_STATUS_NONE)

	// IconSize
	ICON_SIZE_INVALID       = C.GtkIconSize(C.GTK_ICON_SIZE_INVALID)
	ICON_SIZE_MENU          = C.GtkIconSize(C.GTK_ICON_SIZE_MENU)
	ICON_SIZE_SMALL_TOOLBAR = C.GtkIconSize(C.GTK_ICON_SIZE_SMALL_TOOLBAR)
	ICON_SIZE_LARGE_TOOLBAR = C.GtkIconSize(C.GTK_ICON_SIZE_LARGE_TOOLBAR)
	ICON_SIZE_BUTTON        = C.GtkIconSize(C.GTK_ICON_SIZE_BUTTON)
	ICON_SIZE_DND           = C.GtkIconSize(C.GTK_ICON_SIZE_DND)
	ICON_SIZE_DIALOG        = C.GtkIconSize(C.GTK_ICON_SIZE_DIALOG)

	// IconThemeError
	ICON_THEME_NOT_FOUND = C.GtkIconThemeError(C.GTK_ICON_THEME_NOT_FOUND)
	ICON_THEME_FAILED    = C.GtkIconThemeError(C.GTK_ICON_THEME_FAILED)

	// IconViewDropPosition
	ICON_VIEW_NO_DROP    = C.GtkIconViewDropPosition(C.GTK_ICON_VIEW_NO_DROP)
	ICON_VIEW_DROP_INTO  = C.GtkIconViewDropPosition(C.GTK_ICON_VIEW_DROP_INTO)
	ICON_VIEW_DROP_LEFT  = C.GtkIconViewDropPosition(C.GTK_ICON_VIEW_DROP_LEFT)