1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5 "github.com/ebitengine/purego"
6
7 "github.com/bnema/puregotk/pkg/core"
8 "github.com/bnema/puregotk/v4/gdk"
9 "github.com/bnema/puregotk/v4/gio"
10 "github.com/bnema/puregotk/v4/gobject"
11 "github.com/bnema/puregotk/v4/gobject/types"
12)
13
14// Represents a widget tooltip.
15//
16// Basic tooltips can be realized simply by using
17// [method@Gtk.Widget.set_tooltip_text] or
18// [method@Gtk.Widget.set_tooltip_markup] without
19// any explicit tooltip object.
20//
21// When you need a tooltip with a little more fancy contents,
22// like adding an image, or you want the tooltip to have different
23// contents per `GtkTreeView` row or cell, you will have to do a
24// little more work:
25//
26// - Set the [property@Gtk.Widget:has-tooltip] property to %TRUE.
27// This will make GTK monitor the widget for motion and related events
28// which are needed to determine when and where to show a tooltip.
29//
30// - Connect to the [signal@Gtk.Widget::query-tooltip] signal.
31// This signal will be emitted when a tooltip is supposed to be shown.
32// One of the arguments passed to the signal handler is a `GtkTooltip`
33// object. This is the object that we are about to display as a tooltip,
34// and can be manipulated in your callback using functions like
35// [method@Gtk.Tooltip.set_icon]. There are functions for setting
36// the tooltip’s markup, setting an image from a named icon, or even
37// putting in a custom widget.
38//
39// - Return %TRUE from your ::query-tooltip handler. This causes the tooltip
40// to be show. If you return %FALSE, it will not be shown.
41type Tooltip struct {
42 gobject.Object
43}
44
45var xTooltipGLibType func() types.GType
46
47func TooltipGLibType() types.GType {
48 return xTooltipGLibType()
49}
50
51func TooltipNewFromInternalPtr(ptr uintptr) *Tooltip {
52 cls := &Tooltip{}
53 cls.Ptr = ptr
54 return cls
55}
56
57var xTooltipSetCustom func(uintptr, uintptr)
58
59// Replaces the widget packed into the tooltip with
60// @custom_widget. @custom_widget does not get destroyed when the tooltip goes
61// away.
62// By default a box with a `GtkImage` and `GtkLabel` is embedded in
63// the tooltip, which can be configured using gtk_tooltip_set_markup()
64// and gtk_tooltip_set_icon().
65func (x *Tooltip) SetCustom(CustomWidgetVar *Widget) {
66
67 xTooltipSetCustom(x.GoPointer(), CustomWidgetVar.GoPointer())
68
69}
70
71var xTooltipSetIcon func(uintptr, uintptr)
72
73// Sets the icon of the tooltip (which is in front of the text) to be
74// @paintable. If @paintable is %NULL, the image will be hidden.
75func (x *Tooltip) SetIcon(PaintableVar gdk.Paintable) {
76
77 xTooltipSetIcon(x.GoPointer(), PaintableVar.GoPointer())
78
79}
80
81var xTooltipSetIconFromGicon func(uintptr, uintptr)
82
83// Sets the icon of the tooltip (which is in front of the text)
84// to be the icon indicated by @gicon with the size indicated
85// by @size. If @gicon is %NULL, the image will be hidden.
86func (x *Tooltip) SetIconFromGicon(GiconVar gio.Icon) {
87
88 xTooltipSetIconFromGicon(x.GoPointer(), GiconVar.GoPointer())
89
90}
91
92var xTooltipSetIconFromIconName func(uintptr, uintptr)
93
94// Sets the icon of the tooltip (which is in front of the text) to be
95// the icon indicated by @icon_name with the size indicated
96// by @size. If @icon_name is %NULL, the image will be hidden.
97func (x *Tooltip) SetIconFromIconName(IconNameVar *string) {
98
99 IconNameVarPtr := core.GStrdupNullable(IconNameVar)
100 defer core.GFreeNullable(IconNameVarPtr)
101
102 xTooltipSetIconFromIconName(x.GoPointer(), IconNameVarPtr)
103
104}
105
106var xTooltipSetMarkup func(uintptr, uintptr)
107
108// Sets the text of the tooltip to be @markup.
109//
110// The string must be marked up with Pango markup.
111// If @markup is %NULL, the label will be hidden.
112func (x *Tooltip) SetMarkup(MarkupVar *string) {
113
114 MarkupVarPtr := core.GStrdupNullable(MarkupVar)
115 defer core.GFreeNullable(MarkupVarPtr)
116
117 xTooltipSetMarkup(x.GoPointer(), MarkupVarPtr)
118
119}
120
121var xTooltipSetText func(uintptr, uintptr)
122
123// Sets the text of the tooltip to be @text.
124//
125// If @text is %NULL, the label will be hidden.
126// See also [method@Gtk.Tooltip.set_markup].
127func (x *Tooltip) SetText(TextVar *string) {
128
129 TextVarPtr := core.GStrdupNullable(TextVar)
130 defer core.GFreeNullable(TextVarPtr)
131
132 xTooltipSetText(x.GoPointer(), TextVarPtr)
133
134}
135
136var xTooltipSetTipArea func(uintptr, *gdk.Rectangle)
137
138// Sets the area of the widget, where the contents of this tooltip apply,
139// to be @rect (in widget coordinates). This is especially useful for
140// properly setting tooltips on `GtkTreeView` rows and cells, `GtkIconViews`,
141// etc.
142//
143// For setting tooltips on `GtkTreeView`, please refer to the convenience
144// functions for this: gtk_tree_view_set_tooltip_row() and
145// gtk_tree_view_set_tooltip_cell().
146func (x *Tooltip) SetTipArea(RectVar *gdk.Rectangle) {
147
148 xTooltipSetTipArea(x.GoPointer(), RectVar)
149
150}
151
152func (c *Tooltip) GoPointer() uintptr {
153 if c == nil {
154 return 0
155 }
156 return c.Ptr
157}
158
159func (c *Tooltip) SetGoPointer(ptr uintptr) {
160 c.Ptr = ptr
161}
162
163func init() {
164 core.SetPackageName("GTK", "gtk4")
165 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
166 var libs []uintptr
167 for _, libPath := range core.GetPaths("GTK") {
168 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
169 if err != nil {
170 panic(err)
171 }
172 libs = append(libs, lib)
173 }
174
175 core.PuregoSafeRegister(&xTooltipGLibType, libs, "gtk_tooltip_get_type")
176
177 core.PuregoSafeRegister(&xTooltipSetCustom, libs, "gtk_tooltip_set_custom")
178 core.PuregoSafeRegister(&xTooltipSetIcon, libs, "gtk_tooltip_set_icon")
179 core.PuregoSafeRegister(&xTooltipSetIconFromGicon, libs, "gtk_tooltip_set_icon_from_gicon")
180 core.PuregoSafeRegister(&xTooltipSetIconFromIconName, libs, "gtk_tooltip_set_icon_from_icon_name")
181 core.PuregoSafeRegister(&xTooltipSetMarkup, libs, "gtk_tooltip_set_markup")
182 core.PuregoSafeRegister(&xTooltipSetText, libs, "gtk_tooltip_set_text")
183 core.PuregoSafeRegister(&xTooltipSetTipArea, libs, "gtk_tooltip_set_tip_area")
184
185}