// 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/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) // Implements scrollability for widgets that don't support scrolling // on their own. // // Use `GtkViewport` to scroll child widgets such as `GtkGrid`, // `GtkBox`, and so on. // // The `GtkViewport` will start scrolling content only if allocated // less than the child widget’s minimum size in a given orientation. // // # CSS nodes // // `GtkViewport` has a single CSS node with name `viewport`. // // # Accessibility // // Until GTK 4.10, `GtkViewport` used the [enum@Gtk.AccessibleRole.group] role. // // Starting from GTK 4.12, `GtkViewport` uses the [enum@Gtk.AccessibleRole.generic] role. type Viewport struct { Widget } var xViewportGLibType func() types.GType func ViewportGLibType() types.GType { return xViewportGLibType() } func ViewportNewFromInternalPtr(ptr uintptr) *Viewport { cls := &Viewport{} cls.Ptr = ptr return cls } var xNewViewport func(uintptr, uintptr) uintptr // Creates a new `GtkViewport`. // // The new viewport uses the given adjustments, or default // adjustments if none are given. func NewViewport(HadjustmentVar *Adjustment, VadjustmentVar *Adjustment) *Viewport { var cls *Viewport cret := xNewViewport(HadjustmentVar.GoPointer(), VadjustmentVar.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &Viewport{} cls.Ptr = cret return cls } var xViewportGetChild func(uintptr) uintptr // Gets the child widget of @viewport. func (x *Viewport) GetChild() *Widget { var cls *Widget cret := xViewportGetChild(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &Widget{} cls.Ptr = cret return cls } var xViewportGetScrollToFocus func(uintptr) bool // Gets whether the viewport is scrolling to keep the focused // child in view. func (x *Viewport) GetScrollToFocus() bool { cret := xViewportGetScrollToFocus(x.GoPointer()) return cret } var xViewportScrollTo func(uintptr, uintptr, *ScrollInfo) // Scrolls a descendant of the viewport into view. // // The viewport and the descendant must be visible and mapped for // this function to work, otherwise no scrolling will be performed. func (x *Viewport) ScrollTo(DescendantVar *Widget, ScrollVar *ScrollInfo) { xViewportScrollTo(x.GoPointer(), DescendantVar.GoPointer(), ScrollVar) } var xViewportSetChild func(uintptr, uintptr) // Sets the child widget of @viewport. func (x *Viewport) SetChild(ChildVar *Widget) { xViewportSetChild(x.GoPointer(), ChildVar.GoPointer()) } var xViewportSetScrollToFocus func(uintptr, bool) // Sets whether the viewport should automatically scroll // to keep the focused child in view. func (x *Viewport) SetScrollToFocus(ScrollToFocusVar bool) { xViewportSetScrollToFocus(x.GoPointer(), ScrollToFocusVar) } func (c *Viewport) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *Viewport) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // SetPropertyScrollToFocus sets the "scroll-to-focus" property. // Whether to scroll when the focus changes. // // Before 4.6.2, this property was mistakenly defaulting to FALSE, so if your // code needs to work with older versions, consider setting it explicitly to // TRUE. func (x *Viewport) SetPropertyScrollToFocus(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("scroll-to-focus", &v) } // GetPropertyScrollToFocus gets the "scroll-to-focus" property. // Whether to scroll when the focus changes. // // Before 4.6.2, this property was mistakenly defaulting to FALSE, so if your // code needs to work with older versions, consider setting it explicitly to // TRUE. func (x *Viewport) GetPropertyScrollToFocus() bool { var v gobject.Value x.GetProperty("scroll-to-focus", &v) return v.GetBoolean() } // Requests the user's screen reader to announce the given message. // // This kind of notification is useful for messages that // either have only a visual representation or that are not // exposed visually at all, e.g. a notification about a // successful operation. // // Also, by using this API, you can ensure that the message // does not interrupts the user's current screen reader output. func (x *Viewport) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) { XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar) } // Retrieves the accessible parent for an accessible object. // // This function returns `NULL` for top level widgets. func (x *Viewport) GetAccessibleParent() *AccessibleBase { var cls *AccessibleBase cret := XGtkAccessibleGetAccessibleParent(x.GoPointer()) if cret == 0 { return nil } cls = &AccessibleBase{} cls.Ptr = cret return cls } // Retrieves the accessible role of an accessible object. func (x *Viewport) GetAccessibleRole() AccessibleRole { cret := XGtkAccessibleGetAccessibleRole(x.GoPointer()) return cret } // Retrieves the implementation for the given accessible object. func (x *Viewport) GetAtContext() *ATContext { var cls *ATContext cret := XGtkAccessibleGetAtContext(x.GoPointer()) if cret == 0 { return nil } cls = &ATContext{} cls.Ptr = cret return cls } // Queries the coordinates and dimensions of this accessible // // This functionality can be overridden by `GtkAccessible` // implementations, e.g. to get the bounds from an ignored // child widget. func (x *Viewport) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool { cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar) return cret } // Retrieves the first accessible child of an accessible object. func (x *Viewport) GetFirstAccessibleChild() *AccessibleBase { var cls *AccessibleBase cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer()) if cret == 0 { return nil } cls = &AccessibleBase{} cls.Ptr = cret return cls } // Retrieves the next accessible sibling of an accessible object func (x *Viewport) GetNextAccessibleSibling() *AccessibleBase { var cls *AccessibleBase cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer()) if cret == 0 { return nil } cls = &AccessibleBase{} cls.Ptr = cret return cls } // Queries a platform state, such as focus. // // This functionality can be overridden by `GtkAccessible` // implementations, e.g. to get platform state from an ignored // child widget, as is the case for `GtkText` wrappers. func (x *Viewport) GetPlatformState(StateVar AccessiblePlatformState) bool { cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar) return cret } // Resets the accessible property to its default value. func (x *Viewport) ResetProperty(PropertyVar AccessibleProperty) { XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) } // Resets the accessible relation to its default value. func (x *Viewport) ResetRelation(RelationVar AccessibleRelation) { XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) } // Resets the accessible state to its default value. func (x *Viewport) ResetState(StateVar AccessibleState) { XGtkAccessibleResetState(x.GoPointer(), StateVar) } // Sets the parent and sibling of an accessible object. // // This function is meant to be used by accessible implementations that are // not part of the widget hierarchy, and but act as a logical bridge between // widgets. For instance, if a widget creates an object that holds metadata // for each child, and you want that object to implement the `GtkAccessible` // interface, you will use this function to ensure that the parent of each // child widget is the metadata object, and the parent of each metadata // object is the container widget. func (x *Viewport) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) { XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer()) } // Updates the next accessible sibling. // // That might be useful when a new child of a custom accessible // is created, and it needs to be linked to a previous child. func (x *Viewport) UpdateNextAccessibleSibling(NewSiblingVar Accessible) { XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer()) } // Informs ATs that the platform state has changed. // // This function should be used by `GtkAccessible` implementations that // have a platform state but are not widgets. Widgets handle platform // states automatically. func (x *Viewport) UpdatePlatformState(StateVar AccessiblePlatformState) { XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar) } // Updates a list of accessible properties. // // See the [enum@Gtk.AccessibleProperty] documentation for the // value types of accessible properties. // // This function should be called by `GtkWidget` types whenever // an accessible property change must be communicated to assistive // technologies. // // Example: // ```c // value = gtk_adjustment_get_value (adjustment); // gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button), // // GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value, // -1); // // ``` func (x *Viewport) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) { XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...) } // Updates an array of accessible properties. // // This function should be called by `GtkWidget` types whenever an accessible // property change must be communicated to assistive technologies. // // This function is meant to be used by language bindings. func (x *Viewport) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) { XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar) } // Updates a list of accessible relations. // // This function should be called by `GtkWidget` types whenever an accessible // relation change must be communicated to assistive technologies. // // If the [enum@Gtk.AccessibleRelation] requires a list of references, // you should pass each reference individually, followed by `NULL`, e.g. // // ```c // gtk_accessible_update_relation (accessible, // // GTK_ACCESSIBLE_RELATION_CONTROLS, // ref1, NULL, // GTK_ACCESSIBLE_RELATION_LABELLED_BY, // ref1, ref2, ref3, NULL, // -1); // // ``` func (x *Viewport) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) { XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...) } // Updates an array of accessible relations. // // This function should be called by `GtkWidget` types whenever an accessible // relation change must be communicated to assistive technologies. // // This function is meant to be used by language bindings. func (x *Viewport) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) { XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar) } // Updates a list of accessible states. // // See the [enum@Gtk.AccessibleState] documentation for the // value types of accessible states. // // This function should be called by `GtkWidget` types whenever // an accessible state change must be communicated to assistive // technologies. // // Example: // // ```c // value = GTK_ACCESSIBLE_TRISTATE_MIXED; // gtk_accessible_update_state (GTK_ACCESSIBLE (check_button), // // GTK_ACCESSIBLE_STATE_CHECKED, value, // -1); // // ``` func (x *Viewport) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) { XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...) } // Updates an array of accessible states. // // This function should be called by `GtkWidget` types whenever an accessible // state change must be communicated to assistive technologies. // // This function is meant to be used by language bindings. func (x *Viewport) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) { XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar) } // Gets the ID of the @buildable object. // // `GtkBuilder` sets the name based on the ID attribute // of the `<object>` tag used to construct the @buildable. func (x *Viewport) GetBuildableId() string { cret := XGtkBuildableGetBuildableId(x.GoPointer()) return cret } // Returns the size of a non-scrolling border around the // outside of the scrollable. // // An example for this would be treeview headers. GTK can use // this information to display overlaid graphics, like the // overshoot indication, at the right position. func (x *Viewport) GetBorder(BorderVar *Border) bool { cret := XGtkScrollableGetBorder(x.GoPointer(), BorderVar) return cret } // Retrieves the `GtkAdjustment` used for horizontal scrolling. func (x *Viewport) GetHadjustment() *Adjustment { var cls *Adjustment cret := XGtkScrollableGetHadjustment(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &Adjustment{} cls.Ptr = cret return cls } // Gets the horizontal `GtkScrollablePolicy`. func (x *Viewport) GetHscrollPolicy() ScrollablePolicy { cret := XGtkScrollableGetHscrollPolicy(x.GoPointer()) return cret } // Retrieves the `GtkAdjustment` used for vertical scrolling. func (x *Viewport) GetVadjustment() *Adjustment { var cls *Adjustment cret := XGtkScrollableGetVadjustment(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &Adjustment{} cls.Ptr = cret return cls } // Gets the vertical `GtkScrollablePolicy`. func (x *Viewport) GetVscrollPolicy() ScrollablePolicy { cret := XGtkScrollableGetVscrollPolicy(x.GoPointer()) return cret } // Sets the horizontal adjustment of the `GtkScrollable`. func (x *Viewport) SetHadjustment(HadjustmentVar *Adjustment) { XGtkScrollableSetHadjustment(x.GoPointer(), HadjustmentVar.GoPointer()) } // Sets the `GtkScrollablePolicy`. // // The policy determines whether horizontal scrolling should start // below the minimum width or below the natural width. func (x *Viewport) SetHscrollPolicy(PolicyVar ScrollablePolicy) { XGtkScrollableSetHscrollPolicy(x.GoPointer(), PolicyVar) } // Sets the vertical adjustment of the `GtkScrollable`. func (x *Viewport) SetVadjustment(VadjustmentVar *Adjustment) { XGtkScrollableSetVadjustment(x.GoPointer(), VadjustmentVar.GoPointer()) } // Sets the `GtkScrollablePolicy`. // // The policy determines whether vertical scrolling should start // below the minimum height or below the natural height. func (x *Viewport) SetVscrollPolicy(PolicyVar ScrollablePolicy) { XGtkScrollableSetVscrollPolicy(x.GoPointer(), PolicyVar) } 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(&xViewportGLibType, libs, "gtk_viewport_get_type") core.PuregoSafeRegister(&xNewViewport, libs, "gtk_viewport_new") core.PuregoSafeRegister(&xViewportGetChild, libs, "gtk_viewport_get_child") core.PuregoSafeRegister(&xViewportGetScrollToFocus, libs, "gtk_viewport_get_scroll_to_focus") core.PuregoSafeRegister(&xViewportScrollTo, libs, "gtk_viewport_scroll_to") core.PuregoSafeRegister(&xViewportSetChild, libs, "gtk_viewport_set_child") core.PuregoSafeRegister(&xViewportSetScrollToFocus, libs, "gtk_viewport_set_scroll_to_focus") }