Documentation
¶
Index ¶
- func Assert[T any, V any, C interface{ ... }](obj C) (v T, ok bool)
- func ErrHasCode(err error, code int) bool
- func ExpanderRowListBox(row *adw.ExpanderRow) *gtk.ListBox
- func FillFromBuilder[T any](dst *T, builder *gtk.Builder)
- func FillFromUI[T any](into *T, xml ...string)
- func PointerToWidgetter[T any, P interface{ ... }](p P) gtk.Widgetter
- func SetCSSClass(w Classy, class string, force bool)
- func WidgetChildren(w WidgetParent) iter.Seq[gtk.Widgetter]
- type Caster
- type Classy
- type WidgetParent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Assert ¶ added in v0.18.2
Assert casts anything that implements Cast to the specified type. Its main point is to safely and conveniently handle nil.
func ErrHasCode ¶
ErrHasCode returns true if and only if err is a gerror.GError and its error code is code.
func ExpanderRowListBox ¶
func ExpanderRowListBox(row *adw.ExpanderRow) *gtk.ListBox
ExpanderRowListBox returns the gtk.ListBox that is used internally by an adw.ExpanderRow to hold the rows that are shown when it is expanded. This is quite hacky and should be avoided if it can be, but is unfortunately necessary for a couple of things.
func FillFromBuilder ¶
FillFromBuilder sets fields in the struct dst using objects looked up in builder. If the field has a `gtk` tag, the value of it is used as the name to look up in builder, unless the tag is exactly `"-"` in which case the field is skipped. If it does not have a tag, the field name is used instead. If an object by that name does not exist in the builder, it is quietly skipped. If it does exist but is the wrong type, this function will panic.
For example,
var example struct {
Label *gtk.Label
Button *gtk.Button `gtk:"DoneButton"`
}
FillFromBuilder(&example, builder)
will cause the Label field to get filled with the object named "Label" and the Button field to get filled with the object named "DoneButton".
func FillFromUI ¶
FillFromUI loads the given xml data in the order that it is passed and fills into with it in the same way that FillFromBuilder does. Each xml value should be an entire XML UI definition file. This is mostly a convenience function to make it easier to load widgets from embedded files.
func PointerToWidgetter ¶
PointerToWidgetter converts a *T that implements gtk.Widgetter to a gtk.Widgetter, returning nil if the *T is nil. This avoids the nil interface problem.
func SetCSSClass ¶
SetCSSClass adds or removes a CSS class based on a boolean argument.
func WidgetChildren ¶
func WidgetChildren(w WidgetParent) iter.Seq[gtk.Widgetter]
WidgetChildren returns an iterator that performs a pre-order traversal of the widget tree rooted at w. It does not yield w itself.
Types ¶
type Caster ¶ added in v0.18.2
Caster wraps the glib.Object.Cast method.
type Classy ¶
type Classy interface {
AddCSSClass(string)
RemoveCSSClass(string)
HasCSSClass(string) bool
CSSClasses() []string
}
Classy wraps the CSS-related methods of a gtk.Widget.
type WidgetParent ¶
WidgetParent is any type that has child widgets. Gererally speaking, this is every Gtk widget.