glib

package module
v0.0.0-...-a43f7a9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2014 License: BSD-3-Clause Imports: 5 Imported by: 20

README

Go bindings for GLib type system.

This package is designed for building bindings to C libraries based on GLib type system (like GTK, GStreamer, and others).

See example GTK bindings or GStreamer bindings for example code.

See glib_test.go for signal/event handling model.

Dependencies

You need glib 2.0 library with C headers to install this package (libglib2.0-dev on Debian/Ubuntu).

Documentation

http://gopkgdoc.appspot.com/pkg/github.com/ziutek/glib

Documentation

Overview

Bindings for glib

Index

Constants

View Source
const (
	SIGNAL_RUN_FIRST   = C.G_SIGNAL_RUN_FIRST
	SIGNAL_RUN_LAST    = C.G_SIGNAL_RUN_LAST
	SIGNAL_RUN_CLEANUP = C.G_SIGNAL_RUN_CLEANUP
	SIGNAL_NO_RECURSE  = C.G_SIGNAL_NO_RECURSE
	SIGNAL_DETAILED    = C.G_SIGNAL_DETAILED
	SIGNAL_ACTION      = C.G_SIGNAL_ACTION
	SIGNAL_NO_HOOKS    = C.G_SIGNAL_NO_HOOKS
)
View Source
const (
	TYPE_INVALID   = Type(C.G_TYPE_INVALID)
	TYPE_NONE      = Type(C.G_TYPE_NONE)
	TYPE_INTERFACE = Type(C.G_TYPE_INTERFACE)
	TYPE_CHAR      = Type(C.G_TYPE_CHAR)
	TYPE_UCHAR     = Type(C.G_TYPE_UCHAR)
	TYPE_BOOLEAN   = Type(C.G_TYPE_BOOLEAN)
	TYPE_INT       = Type(C.G_TYPE_INT)
	TYPE_GO_INT32  = TYPE_INT
	TYPE_UINT      = Type(C.G_TYPE_UINT)
	TYPE_GO_UINT32 = TYPE_UINT
	TYPE_LONG      = Type(C.G_TYPE_LONG)
	TYPE_GO_INT    = TYPE_LONG
	TYPE_ULONG     = Type(C.G_TYPE_ULONG)
	TYPE_GO_UINT   = TYPE_ULONG
	TYPE_INT64     = Type(C.G_TYPE_INT64)
	TYPE_UINT64    = Type(C.G_TYPE_UINT64)
	TYPE_ENUM      = Type(C.G_TYPE_ENUM)
	TYPE_FLAGS     = Type(C.G_TYPE_FLAGS)
	TYPE_FLOAT     = Type(C.G_TYPE_FLOAT)
	TYPE_DOUBLE    = Type(C.G_TYPE_DOUBLE)
	TYPE_STRING    = Type(C.G_TYPE_STRING)
	TYPE_POINTER   = Type(C.G_TYPE_POINTER)
	TYPE_BOXED     = Type(C.G_TYPE_BOXED)
	TYPE_PARAM     = Type(C.G_TYPE_PARAM)
	TYPE_OBJECT    = Type(C.G_TYPE_OBJECT)
	TYPE_VARIANT   = Type(C.G_TYPE_VARIANT)
)

Variables

This section is empty.

Functions

func SignalLookup

func SignalLookup(name string, t Type) (sid SignalId, detail Quark)

Types

type Error

type Error C.GError

func (*Error) Error

func (e *Error) Error() string

func (*Error) GetCode

func (e *Error) GetCode() int

func (*Error) GetDomain

func (e *Error) GetDomain() Quark

type MainContext

type MainContext struct {
	Object
}

func DefaultMainContext

func DefaultMainContext() *MainContext

func NewMainContext

func NewMainContext() *MainContext

func (MainContext) GMainContext

func (k MainContext) GMainContext() *C.GMainContext

func (MainContext) Iteration

func (k MainContext) Iteration(may_block bool) bool

func (MainContext) Pending

func (k MainContext) Pending() bool

type MainLoop

type MainLoop struct {
	Object
}

func NewMainLoop

func NewMainLoop(ctx *MainContext) *MainLoop

func (MainLoop) GMainLoop

func (l MainLoop) GMainLoop() *C.GMainLoop

func (MainLoop) GetContext

func (l MainLoop) GetContext() *MainContext

func (MainLoop) IsRunning

func (l MainLoop) IsRunning() bool

func (MainLoop) Quit

func (l MainLoop) Quit()

func (MainLoop) Run

func (l MainLoop) Run()

type Object

type Object struct {
	// contains filtered or unexported fields
}

func NewObject

func NewObject(t Type, params Params) *Object

func (*Object) AsObject

func (o *Object) AsObject() *Object

func (*Object) Connect

func (o *Object) Connect(sig_name string, cb_func, param0 interface{})

Connect callback to signal specified by name.

func (*Object) ConnectNoi

func (o *Object) ConnectNoi(sig_name string, cb_func, param0 interface{})

Connect callback to signal specified by name. Doesn't pass o as first parameter to callback.

func (*Object) ConnectSid

func (o *Object) ConnectSid(sid SignalId, detail Quark,
	cb_func, param0 interface{})

Connect callback to signal specified by id

func (*Object) ConnectSidNoi

func (o *Object) ConnectSidNoi(sid SignalId, detail Quark,
	cb_func, param0 interface{})

Connect callback to signal specified by id. Doesn't pass o as first parameter to callback.

func (*Object) Emit

func (o *Object) Emit(sig_name string, args ...interface{}) interface{}

func (*Object) EmitById

func (o *Object) EmitById(sid SignalId, detail Quark, args ...interface{}) interface{}

func (*Object) GetProperty

func (o *Object) GetProperty(name string) interface{}

func (*Object) GetPtr

func (o *Object) GetPtr() Pointer

func (*Object) Ref

func (o *Object) Ref() *Object

func (*Object) RefSink

func (o *Object) RefSink() *Object

func (*Object) SetProperty

func (o *Object) SetProperty(name string, val interface{})

func (*Object) SetPtr

func (o *Object) SetPtr(p Pointer)

func (*Object) Type

func (o *Object) Type() Type

func (*Object) Unref

func (o *Object) Unref()

func (*Object) Value

func (o *Object) Value() *Value

type ObjectCaster

type ObjectCaster interface {
	AsObject() *Object
}

type Params

type Params map[string]interface{}

type Pointer

type Pointer C.gpointer

type PointerSetter

type PointerSetter interface {
	SetPtr(p Pointer)
}

type Quark

type Quark C.GQuark

func QuarkFromString

func QuarkFromString(s string) Quark

func (Quark) GQuark

func (q Quark) GQuark() C.GQuark

func (Quark) String

func (q Quark) String() string

type SigHandlerId

type SigHandlerId C.gulong

type SignalFlags

type SignalFlags C.GSignalFlags

type SignalId

type SignalId C.guint

func NewSignal

func NewSignal(name string, rt, it Type, pt ...Type) SignalId

func (SignalId) String

func (s SignalId) String() string

type Type

type Type C.GType

A numerical value which represents the unique identifier of a registered type

var TYPE_GTYPE Type

func TypeFromName

func TypeFromName(name string) Type

func TypeOf

func TypeOf(i interface{}) Type

TypeOf returns the Type of the value in the i}.

func (Type) Compatible

func (t Type) Compatible(dst Type) bool

func (Type) Depth

func (t Type) Depth() int

func (Type) IsA

func (t Type) IsA(it Type) bool

If t type is a derivable type, check whether type is a descendant of it type. If t type is an glib interface, check whether type conforms to it.

func (Type) Match

func (t Type) Match(rt reflect.Type) bool

func (Type) NextBase

func (t Type) NextBase(root Type) Type

Returns the type that is derived directly from root type which is also a base class of t

func (Type) Parent

func (t Type) Parent() Type

func (Type) QName

func (t Type) QName() Quark

func (Type) String

func (t Type) String() string

func (Type) Transformable

func (t Type) Transformable(dst Type) bool

func (Type) Type

func (t Type) Type() Type

func (Type) Value

func (t Type) Value() *Value

type TypeGetter

type TypeGetter interface {
	Type() Type
}

type Value

type Value C.GValue

func NewValue

func NewValue(t Type) (v *Value)

Returns new initializes value

func ValueOf

func ValueOf(i interface{}) *Value

Returns a pointer to new Value initialized to the value stored in the interface i. If i contains pointer to Value returns this pointer.

func (*Value) Copy

func (v *Value) Copy(dst *Value)

Copy copies the value into dst.

func (*Value) Get

func (v *Value) Get() interface{}

func (*Value) GetBool

func (v *Value) GetBool() bool

func (*Value) GetFloat32

func (v *Value) GetFloat32() float32

func (*Value) GetFloat64

func (v *Value) GetFloat64() float64

func (*Value) GetInt

func (v *Value) GetInt() int

func (*Value) GetInt32

func (v *Value) GetInt32() int32

func (*Value) GetInt64

func (v *Value) GetInt64() int64

func (*Value) GetInt8

func (v *Value) GetInt8() int8

func (*Value) GetObject

func (v *Value) GetObject() *Object

func (*Value) GetPointer

func (v *Value) GetPointer() Pointer

func (*Value) GetString

func (v *Value) GetString() string

func (*Value) GetType

func (v *Value) GetType() Type

func (*Value) GetUint

func (v *Value) GetUint() uint

func (*Value) GetUint32

func (v *Value) GetUint32() uint32

func (*Value) GetUint64

func (v *Value) GetUint64() uint64

func (*Value) GetUint8

func (v *Value) GetUint8() uint8

func (*Value) Init

func (v *Value) Init(t Type)

Initializes value with the default value of type.

func (*Value) Set

func (v *Value) Set(i interface{})

Set value to i

func (*Value) String

func (v *Value) String() string

func (*Value) Transform

func (v *Value) Transform(dst *Value)

Transform transforms the value into dst.

func (*Value) Type

func (v *Value) Type() Type

Returns v's type.

func (*Value) Unset

func (v *Value) Unset()

Clears the current value in value and "unsets" the type,

type ValueGetter

type ValueGetter interface {
	Value() *Value
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL