// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT package gtk import ( "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/gdk" "github.com/bnema/puregotk/v4/gio" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) // Represents a widget tooltip. // // Basic tooltips can be realized simply by using // [method@Gtk.Widget.set_tooltip_text] or // [method@Gtk.Widget.set_tooltip_markup] without // any explicit tooltip object. // // When you need a tooltip with a little more fancy contents, // like adding an image, or you want the tooltip to have different // contents per `GtkTreeView` row or cell, you will have to do a // little more work: // // - Set the [property@Gtk.Widget:has-tooltip] property to %TRUE. // This will make GTK monitor the widget for motion and related events // which are needed to determine when and where to show a tooltip. // // - Connect to the [signal@Gtk.Widget::query-tooltip] signal. // This signal will be emitted when a tooltip is supposed to be shown. // One of the arguments passed to the signal handler is a `GtkTooltip` // object. This is the object that we are about to display as a tooltip, // and can be manipulated in your callback using functions like // [method@Gtk.Tooltip.set_icon]. There are functions for setting // the tooltip’s markup, setting an image from a named icon, or even // putting in a custom widget. // // - Return %TRUE from your ::query-tooltip handler. This causes the tooltip // to be show. If you return %FALSE, it will not be shown. type Tooltip struct { gobject.Object } var xTooltipGLibType func() types.GType func TooltipGLibType() types.GType { return xTooltipGLibType() } func TooltipNewFromInternalPtr(ptr uintptr) *Tooltip { cls := &Tooltip{} cls.Ptr = ptr return cls } var xTooltipSetCustom func(uintptr, uintptr) // Replaces the widget packed into the tooltip with // @custom_widget. @custom_widget does not get destroyed when the tooltip goes // away. // By default a box with a `GtkImage` and `GtkLabel` is embedded in // the tooltip, which can be configured using gtk_tooltip_set_markup() // and gtk_tooltip_set_icon(). func (x *Tooltip) SetCustom(CustomWidgetVar *Widget) { xTooltipSetCustom(x.GoPointer(), CustomWidgetVar.GoPointer()) } var xTooltipSetIcon func(uintptr, uintptr) // Sets the icon of the tooltip (which is in front of the text) to be // @paintable. If @paintable is %NULL, the image will be hidden. func (x *Tooltip) SetIcon(PaintableVar gdk.Paintable) { xTooltipSetIcon(x.GoPointer(), PaintableVar.GoPointer()) } var xTooltipSetIconFromGicon func(uintptr, uintptr) // Sets the icon of the tooltip (which is in front of the text) // to be the icon indicated by @gicon with the size indicated // by @size. If @gicon is %NULL, the image will be hidden. func (x *Tooltip) SetIconFromGicon(GiconVar gio.Icon) { xTooltipSetIconFromGicon(x.GoPointer(), GiconVar.GoPointer()) } var xTooltipSetIconFromIconName func(uintptr, uintptr) // Sets the icon of the tooltip (which is in front of the text) to be // the icon indicated by @icon_name with the size indicated // by @size. If @icon_name is %NULL, the image will be hidden. func (x *Tooltip) SetIconFromIconName(IconNameVar *string) { IconNameVarPtr := core.GStrdupNullable(IconNameVar) defer core.GFreeNullable(IconNameVarPtr) xTooltipSetIconFromIconName(x.GoPointer(), IconNameVarPtr) } var xTooltipSetMarkup func(uintptr, uintptr) // Sets the text of the tooltip to be @markup. // // The string must be marked up with Pango markup. // If @markup is %NULL, the label will be hidden. func (x *Tooltip) SetMarkup(MarkupVar *string) { MarkupVarPtr := core.GStrdupNullable(MarkupVar) defer core.GFreeNullable(MarkupVarPtr) xTooltipSetMarkup(x.GoPointer(), MarkupVarPtr) } var xTooltipSetText func(uintptr, uintptr) // Sets the text of the tooltip to be @text. // // If @text is %NULL, the label will be hidden. // See also [method@Gtk.Tooltip.set_markup]. func (x *Tooltip) SetText(TextVar *string) { TextVarPtr := core.GStrdupNullable(TextVar) defer core.GFreeNullable(TextVarPtr) xTooltipSetText(x.GoPointer(), TextVarPtr) } var xTooltipSetTipArea func(uintptr, *gdk.Rectangle) // Sets the area of the widget, where the contents of this tooltip apply, // to be @rect (in widget coordinates). This is especially useful for // properly setting tooltips on `GtkTreeView` rows and cells, `GtkIconViews`, // etc. // // For setting tooltips on `GtkTreeView`, please refer to the convenience // functions for this: gtk_tree_view_set_tooltip_row() and // gtk_tree_view_set_tooltip_cell(). func (x *Tooltip) SetTipArea(RectVar *gdk.Rectangle) { xTooltipSetTipArea(x.GoPointer(), RectVar) } func (c *Tooltip) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *Tooltip) SetGoPointer(ptr uintptr) { c.Ptr = ptr } func init() { core.SetPackageName("GTK", "gtk4") core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"}) var libs []uintptr for _, libPath := range core.GetPaths("GTK") { lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { panic(err) } libs = append(libs, lib) } core.PuregoSafeRegister(&xTooltipGLibType, libs, "gtk_tooltip_get_type") core.PuregoSafeRegister(&xTooltipSetCustom, libs, "gtk_tooltip_set_custom") core.PuregoSafeRegister(&xTooltipSetIcon, libs, "gtk_tooltip_set_icon") core.PuregoSafeRegister(&xTooltipSetIconFromGicon, libs, "gtk_tooltip_set_icon_from_gicon") core.PuregoSafeRegister(&xTooltipSetIconFromIconName, libs, "gtk_tooltip_set_icon_from_icon_name") core.PuregoSafeRegister(&xTooltipSetMarkup, libs, "gtk_tooltip_set_markup") core.PuregoSafeRegister(&xTooltipSetText, libs, "gtk_tooltip_set_text") core.PuregoSafeRegister(&xTooltipSetTipArea, libs, "gtk_tooltip_set_tip_area") }