File: text_child_anchor.go

package info (click to toggle)
golang-github-gotk3-gotk3 0.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,332 kB
  • sloc: ansic: 904; makefile: 4
file content (81 lines) | stat: -rw-r--r-- 1,985 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Same copyright and license as the rest of the files in this project

package gtk

// #include <gtk/gtk.h>
// #include "text_child_anchor.go.h"
import "C"
import (
	"unsafe"

	"github.com/gotk3/gotk3/glib"
)

func init() {
	tm := []glib.TypeMarshaler{
		// Objects/Interfaces
		{glib.Type(C.gtk_text_child_anchor_get_type()), marshalTextChildAnchor},
	}
	glib.RegisterGValueMarshalers(tm)
}

/*
 * GtkTextChildAnchor
 */

// TextChildAnchor is a representation of GTK's GtkTextChildAnchor
type TextChildAnchor struct {
	glib.InitiallyUnowned
}

// native returns a pointer to the underlying GtkTextChildAnchor.
func (v *TextChildAnchor) native() *C.GtkTextChildAnchor {
	if v == nil || v.GObject == nil {
		return nil
	}
	p := unsafe.Pointer(v.GObject)
	return C.toGtkTextChildAnchor(p)
}

func marshalTextChildAnchor(p uintptr) (interface{}, error) {
	c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p)))
	obj := glib.Take(unsafe.Pointer(c))
	return wrapTextChildAnchor(obj), nil
}

func wrapTextChildAnchor(obj *glib.Object) *TextChildAnchor {
	if obj == nil {
		return nil
	}

	return &TextChildAnchor{glib.InitiallyUnowned{obj}}
}

// TextChildAnchorNew is a wrapper around gtk_text_child_anchor_new ()
func TextChildAnchorNew() (*TextChildAnchor, error) {
	c := C.gtk_text_child_anchor_new()
	if c == nil {
		return nil, nilPtrErr
	}
	return wrapTextChildAnchor(glib.Take(unsafe.Pointer(c))), nil
}

// GetWidgets is a wrapper around gtk_text_child_anchor_get_widgets ().
func (v *TextChildAnchor) GetWidgets() *glib.List {
	clist := C.gtk_text_child_anchor_get_widgets(v.native())
	if clist == nil {
		return nil
	}

	glist := glib.WrapList(uintptr(unsafe.Pointer(clist)))
	glist.DataWrapper(func(ptr unsafe.Pointer) interface{} {
		return wrapWidget(glib.Take(ptr))
	})

	return glist
}

// GetDeleted is a wrapper around gtk_text_child_anchor_get_deleted().
func (v *TextChildAnchor) GetDeleted() bool {
	return gobool(C.gtk_text_child_anchor_get_deleted(v.native()))
}