glib

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package glib provides Go bindings for GLib, only imlementing the necessary functions for the goxis project.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompareDataFunc

type CompareDataFunc func(a, b uintptr) int

CompareDataFunc is a representation of GCompareDataFunc

type GMainLoop

type GMainLoop struct {
	Ptr *C.GMainLoop
}

GMainLoop is a representation of GLib's GMainLoop structure, encapsulating the functionality of a main event loop. A GMainLoop is a loop that processes events for a context.

func NewMainLoop

func NewMainLoop() *GMainLoop

NewMainLoop creates and returns a new GMainLoop. This function creates a new event loop object with a reference count of 1. The loop is set to not automatically quit upon the termination of its last source, allowing for manual control.

https://docs.gtk.org/glib/ctor.MainLoop.new.html

Returns:

  • *GMainLoop: A pointer to the newly created GMainLoop.

func (*GMainLoop) Quit

func (g *GMainLoop) Quit()

Quit stops the GMainLoop, causing Start to return. It is safe to call this function from any thread. The function decreases the reference count of the GMainLoop object and frees it if this was the last reference. After calling Quit, the GMainLoop should not be used anymore.

https://docs.gtk.org/glib/method.MainLoop.quit.html

func (*GMainLoop) Run

func (g *GMainLoop) Run()

Run begins the execution of the GMainLoop. This function locks the current OS thread, runs the event loop, and processes events for the context until Quit is called. It's important to manage concurrency and ensure that Start is called from the appropriate execution context, as it will lock the calling thread.

https://docs.gtk.org/glib/method.MainLoop.run.html

type List

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

List is a representation of Glib's GList. Copied from https://github.com/gotk3/gotk3/blob/master/glib/list.go

func WrapList

func WrapList(obj uintptr) *List

func (*List) Append

func (v *List) Append(data uintptr) *List

Append is a wrapper around g_list_append().

func (*List) Data

func (v *List) Data() interface{}

Data acts the same as data struct field, but passes retrieved value before returning through wrap function, set by DataWrapper(). If no wrap function is set, it returns raw unsafe.Pointer.

func (*List) DataWrapper

func (v *List) DataWrapper(fn func(unsafe.Pointer) interface{})

DataWapper sets wrap functions, which is called during NthData() and Data(). It's used to cast raw C data into appropriate Go structures and types every time that data is retreived.

func (*List) First

func (v *List) First() *List

First is a wrapper around g_list_first().

func (*List) Foreach

func (v *List) Foreach(fn func(item interface{}))

Foreach acts the same as g_list_foreach(). No user_data argument is implemented because of Go clojure capabilities.

func (*List) Free

func (v *List) Free()

Free is a wrapper around g_list_free().

func (*List) FreeFull

func (v *List) FreeFull(fn func(item interface{}))

FreeFull acts the same as g_list_free_full(). Calling list.FreeFull(fn) is equivalent to calling list.Foreach(fn) and list.Free() sequentially.

func (*List) Insert

func (v *List) Insert(data uintptr, position int) *List

Insert is a wrapper around g_list_insert().

func (*List) Last

func (v *List) Last() *List

Last is a wrapper around g_list_last().

func (*List) Length

func (v *List) Length() uint

Length is a wrapper around g_list_length().

func (*List) Native

func (v *List) Native() uintptr

func (*List) Next

func (v *List) Next() *List

Next is a wrapper around the next struct field

func (*List) Nth

func (v *List) Nth(n uint) *List

Nth() is a wrapper around g_list_nth().

func (*List) NthData

func (v *List) NthData(n uint) interface{}

NthData acts the same as g_list_nth_data(), but passes retrieved value before returning through wrap function, set by DataWrapper(). If no wrap function is set, it returns raw unsafe.Pointer.

func (*List) Prepend

func (v *List) Prepend(data uintptr) *List

Prepend is a wrapper around g_list_prepend().

func (*List) Previous

func (v *List) Previous() *List

Previous is a wrapper around the prev struct field

func (*List) Reverse

func (v *List) Reverse() *List

Reverse is a wrapper around g_list_reverse().

Jump to

Keyboard shortcuts

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