本文整理汇总了Golang中github.com/twstrike/gotk3/glib.ToGObject函数的典型用法代码示例。如果您正苦于以下问题:Golang ToGObject函数的具体用法?Golang ToGObject怎么用?Golang ToGObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ToGObject函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: 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)
}
示例2: 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
}
示例3: 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
}
示例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
}
示例5: 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
}
示例6: 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
}
示例7: 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
}
示例8: 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
}
示例9: 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
}
示例10: GetPixbuf
// GetPixbuf is a wrapper around gdk_pixbuf_loader_get_pixbuf().
func (v *PixbufLoader) GetPixbuf() (*Pixbuf, error) {
c := C.gdk_pixbuf_loader_get_pixbuf(v.native())
if c == nil {
return nil, nilPtrErr
}
obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))}
p := &Pixbuf{obj}
obj.Ref()
runtime.SetFinalizer(obj, (*glib.Object).Unref)
return p, nil
}
示例11: ScaleSimple
// ScaleSimple is a wrapper around gdk_pixbuf_scale_simple().
func (v *Pixbuf) ScaleSimple(destWidth, destHeight int, interpType InterpType) (*Pixbuf, error) {
c := C.gdk_pixbuf_scale_simple(v.native(), C.int(destWidth),
C.int(destHeight), C.GdkInterpType(interpType))
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
}
示例12: GetSystemVisual
// GetSystemVisual is a wrapper around gdk_screen_get_system_visual().
func (v *Screen) GetSystemVisual() (*Visual, error) {
c := C.gdk_screen_get_system_visual(v.native())
if c == nil {
return nil, nilPtrErr
}
obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))}
visual := &Visual{obj}
obj.Ref()
runtime.SetFinalizer(obj, (*glib.Object).Unref)
return visual, nil
}
示例13: 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
}
示例14: PixbufNew
// PixbufNew is a wrapper around gdk_pixbuf_new().
func PixbufNew(colorspace Colorspace, hasAlpha bool, bitsPerSample, width, height int) (*Pixbuf, error) {
c := C.gdk_pixbuf_new(C.GdkColorspace(colorspace), gbool(hasAlpha),
C.int(bitsPerSample), C.int(width), C.int(height))
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
}
示例15: GetDefaultGroup
// GetDefaultGroup() is a wrapper around gdk_display_get_default_group().
func (v *Display) GetDefaultGroup() (*Window, error) {
c := C.gdk_display_get_default_group(v.native())
if c == nil {
return nil, nilPtrErr
}
obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))}
w := &Window{obj}
obj.Ref()
runtime.SetFinalizer(obj, (*glib.Object).Unref)
return w, nil
}