當前位置: 首頁>>代碼示例>>Golang>>正文


Golang glib.ToGObject函數代碼示例

本文整理匯總了Golang中github.com/gotk3/gotk3/glib.ToGObject函數的典型用法代碼示例。如果您正苦於以下問題:Golang ToGObject函數的具體用法?Golang ToGObject怎麽用?Golang ToGObject使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了ToGObject函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: toDisplay

func toDisplay(s *C.GdkDisplay) (*Display, error) {
	if s == nil {
		return nil, nilPtrErr
	}
	obj := &glib.Object{glib.ToGObject(unsafe.Pointer(s))}
	return &Display{obj}, nil
}
開發者ID:yamnikov-oleg,項目名稱:gotk3,代碼行數:7,代碼來源:gdk.go

示例2: GetItemLink

/*
Queries the item at position item_index in model for the link specified by link .
If the link exists, the linked GMenuModel is returned. If the link does not exist, NULL is returned.
*/
func (v *MenuModel) GetItemLink(item_index int, link string) *MenuModel {
	cstrlink := C.CString(link)
	defer C.free(unsafe.Pointer(cstrlink))
	c := C.g_menu_model_get_item_link(v.native(), (C.gint)(item_index), (*C.gchar)(cstrlink))
	obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))}
	return wrapMenuModel(obj)
}
開發者ID:gotk3,項目名稱:gio,代碼行數:11,代碼來源:GMenuModel.go

示例3: LookAction

//GAction *
//g_action_map_lookup_action (GActionMap *action_map,
//                            const gchar *action_name);
//Looks up the action with the name action_name in action_map .
//If no such action exists, returns NULL.
func (v *ActionMap) LookAction(action_name string) *Action {
	cstr := C.CString(action_name)
	defer C.free(unsafe.Pointer(cstr))
	c := C.g_action_map_lookup_action(v.native(), (*C.gchar)(cstr))
	obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))}
	return wrapAction(obj)
}
開發者ID:gotk3,項目名稱:gio,代碼行數:12,代碼來源:GActionMap.go

示例4: toWindow

func toWindow(s *C.GdkWindow) (*Window, error) {
	if s == nil {
		return nil, nilPtrErr
	}
	obj := &glib.Object{glib.ToGObject(unsafe.Pointer(s))}
	return &Window{obj}, nil
}
開發者ID:yamnikov-oleg,項目名稱:gotk3,代碼行數:7,代碼來源:gdk.go

示例5: SimpleActionNewStateful

//g_simple_action_new_stateful ()
//GSimpleAction *
//g_simple_action_new_stateful (const gchar *name,
//                              const GVariantType *parameter_type,
//                              GVariant *state);
//Creates a new stateful action.
//state is the initial state of the action. All future state values must have the same GVariantType as the initial state.
//If the state GVariant is floating, it is consumed.
func SimpleActionNewStateful(name string, parameter_type *glib.VariantType, state *glib.Variant) *SimpleAction {
	cstr := C.CString(name)
	defer C.free(unsafe.Pointer(cstr))
	c := C.g_simple_action_new_stateful((*C.gchar)(cstr), (*C.GVariantType)(parameter_type.GVariantType), (*C.GVariant)(state.GVariant))
	obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))}
	return wrapSimpleAction(obj)
}
開發者ID:gotk3,項目名稱:gio,代碼行數:15,代碼來源:GSimpleAction.go

示例6: toScreen

func toScreen(s *C.GdkScreen) (*Screen, error) {
	if s == nil {
		return nil, nilPtrErr
	}
	obj := &glib.Object{glib.ToGObject(unsafe.Pointer(s))}
	return &Screen{obj}, nil
}
開發者ID:yamnikov-oleg,項目名稱:gotk3,代碼行數:7,代碼來源:screen.go

示例7: goBuilderConnect

//export goBuilderConnect
func goBuilderConnect(builder *C.GtkBuilder,
	object *C.GObject,
	signal_name *C.gchar,
	handler_name *C.gchar,
	connect_object *C.GObject,
	flags C.GConnectFlags,
	user_data C.gpointer) {

	builderSignals.Lock()
	signals, ok := builderSignals.m[builder]
	builderSignals.Unlock()

	if !ok {
		panic("no signal mapping defined for this GtkBuilder")
	}

	h := C.GoString((*C.char)(handler_name))
	s := C.GoString((*C.char)(signal_name))

	handler, ok := signals[h]
	if !ok {
		return
	}

	if object == nil {
		panic("unexpected nil object from builder")
	}

	//TODO: figure out a better way to get a glib.Object from a *C.GObject
	gobj := glib.Object{glib.ToGObject(unsafe.Pointer(object))}
	gobj.Connect(s, handler)
}
開發者ID:yamnikov-oleg,項目名稱:gotk3,代碼行數:33,代碼來源:gtk_export.go

示例8: GetDisplay

// GetDisplay() is a wrapper around gdk_device_manager_get_display().
func (v *DeviceManager) GetDisplay() (*Display, error) {
	c := C.gdk_device_manager_get_display(v.native())
	if c == nil {
		return nil, nilPtrErr
	}
	obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))}
	obj.Ref()
	runtime.SetFinalizer(obj, (*glib.Object).Unref)
	return &Display{obj}, nil
}
開發者ID:yamnikov-oleg,項目名稱:gotk3,代碼行數:11,代碼來源:gdk.go

示例9: Flip

// Flip is a wrapper around gdk_pixbuf_flip().
func (v *Pixbuf) Flip(horizontal bool) (*Pixbuf, error) {
	c := C.gdk_pixbuf_flip(v.native(), gbool(horizontal))
	if c == nil {
		return nil, nilPtrErr
	}
	obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))}
	p := &Pixbuf{obj}
	runtime.SetFinalizer(obj, (*glib.Object).Unref)
	return p, nil
}
開發者ID:raichu,項目名稱:gotk3,代碼行數:11,代碼來源:gdk.go

示例10: PixbufLoaderNew

// PixbufLoaderNew() is a wrapper around gdk_pixbuf_loader_new().
func PixbufLoaderNew() (*PixbufLoader, error) {
	c := C.gdk_pixbuf_loader_new()
	if c == nil {
		return nil, nilPtrErr
	}
	obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))}
	p := &PixbufLoader{obj}
	runtime.SetFinalizer(obj, (*glib.Object).Unref)
	return p, nil
}
開發者ID:raichu,項目名稱:gotk3,代碼行數:11,代碼來源:gdk.go

示例11: RotateSimple

// RotateSimple is a wrapper around gdk_pixbuf_rotate_simple().
func (v *Pixbuf) RotateSimple(angle PixbufRotation) (*Pixbuf, error) {
	c := C.gdk_pixbuf_rotate_simple(v.native(), C.GdkPixbufRotation(angle))
	if c == nil {
		return nil, nilPtrErr
	}
	obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))}
	p := &Pixbuf{obj}
	runtime.SetFinalizer(obj, (*glib.Object).Unref)
	return p, nil
}
開發者ID:raichu,項目名稱:gotk3,代碼行數:11,代碼來源:gdk.go

示例12: ApplyEmbeddedOrientation

// ApplyEmbeddedOrientation is a wrapper around gdk_pixbuf_apply_embedded_orientation().
func (v *Pixbuf) ApplyEmbeddedOrientation() (*Pixbuf, error) {
	c := C.gdk_pixbuf_apply_embedded_orientation(v.native())
	if c == nil {
		return nil, nilPtrErr
	}
	obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))}
	p := &Pixbuf{obj}
	runtime.SetFinalizer(obj, (*glib.Object).Unref)
	return p, nil
}
開發者ID:raichu,項目名稱:gotk3,代碼行數:11,代碼來源:gdk.go

示例13: PixbufCopy

// PixbufCopy is a wrapper around gdk_pixbuf_copy().
func PixbufCopy(v *Pixbuf) (*Pixbuf, error) {
	c := C.gdk_pixbuf_copy(v.native())
	if c == nil {
		return nil, nilPtrErr
	}
	obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))}
	p := &Pixbuf{obj}
	runtime.SetFinalizer(obj, (*glib.Object).Unref)
	return p, nil
}
開發者ID:yamnikov-oleg,項目名稱:gotk3,代碼行數:11,代碼來源:gdk.go

示例14: GetDefaultScreen

// GetDefaultScreen() is a wrapper around gdk_display_get_default_screen().
func (v *Display) GetDefaultScreen() (*Screen, error) {
	c := C.gdk_display_get_default_screen(v.native())
	if c == nil {
		return nil, nilPtrErr
	}
	obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))}
	s := &Screen{obj}
	obj.Ref()
	runtime.SetFinalizer(obj, (*glib.Object).Unref)
	return s, nil
}
開發者ID:raichu,項目名稱:gotk3,代碼行數:12,代碼來源:gdk.go

示例15: DisplayGetDefault

// DisplayGetDefault() is a wrapper around gdk_display_get_default().
func DisplayGetDefault() (*Display, error) {
	c := C.gdk_display_get_default()
	if c == nil {
		return nil, nilPtrErr
	}
	obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))}
	d := &Display{obj}
	obj.Ref()
	runtime.SetFinalizer(obj, (*glib.Object).Unref)
	return d, nil
}
開發者ID:raichu,項目名稱:gotk3,代碼行數:12,代碼來源:gdk.go


注:本文中的github.com/gotk3/gotk3/glib.ToGObject函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。