Commit f5e0a844 authored by Roman Alifanov's avatar Roman Alifanov

update vendored go modules with go mod vendor for 0.1.0 (see…

update vendored go modules with go mod vendor for 0.1.0 (see predownloaded-development in .gear/rules)
parent 2d21f551
MIT License
Copyright (c) 2022 Karpelès Lab Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
#!/bin/make
GOROOT:=$(shell PATH="/pkg/main/dev-lang.go.dev/bin:$$PATH" go env GOROOT)
GOPATH:=$(shell $(GOROOT)/bin/go env GOPATH)
.PHONY: test deps
all:
$(GOPATH)/bin/goimports -w -l .
$(GOROOT)/bin/go build -v
deps:
$(GOROOT)/bin/go get -v -t .
test:
$(GOROOT)/bin/go test -v
[![GoDoc](https://godoc.org/github.com/KarpelesLab/weak?status.svg)](https://godoc.org/github.com/KarpelesLab/weak)
# weakref map in go 1.18
This is a weakref map for Go 1.18, with some inspiration from [xeus2001's weakref implementation](https://github.com/xeus2001/go-weak).
This provides both a `weak.Ref` object to store weak references, and a `weak.Map` object for maps.
## Usage
```go
import "github.com/KarpelesLab/weak"
var m = weak.NewMap[uint64, Object]()
// instanciate/get an object
func Get(id uint64) (*Object, error) {
// try to get from cache
var obj *Object
if obj = m.Get(id); obj == nil {
// create new
obj = m.Set(id, &Object{id: id}) // this will return an existing object if already existing
}
obj.initOnce.Do(obj.init) // use sync.Once to ensure init happens only once
return obj, obj.err
}
func main() {
obj, err := Get(1234)
// ...
}
```
As to the `Object` implementation, it could look like:
```go
type Object struct {
id uint64
initOnce sync.Once
f *os.File
err error
}
func (o *Object) init() {
o.f, o.err = os.Open(fmt.Sprintf("/tmp/file%d.bin", o.id))
}
func (o *Object) Destroy() {
if o.f != nil {
o.f.Close()
}
}
```
### File example
Simple example that allows opening multiple files without having to care about closing these and reading random data using `ReadAt`.
```go
import {
"github.com/KarpelesLab/weak"
"os"
"sync"
}
type File struct {
*os.File
err error
open sync.Once
}
var fileCache = weak.NewMap[string, File]()
func Open(filepath string) (io.ReaderAt, error) (
var f *File
if f = fileCache.Get(filepath); f == nil {
f = fileCache.Set(filepath, &File{})
}
f.open.Do(func() {
f.File, f.err = os.Open(filepath)
})
return f, f.err
}
func (f *File) Destroy() {
if f.File != nil {
f.File.Close()
}
}
```
package weak
import (
"sync"
)
// Map is a thread safe map for objects to be kept as weak references, useful for cache/etc
type Map[K comparable, T any] struct {
m map[K]*Ref[T]
l sync.RWMutex
}
// Object implementing Destroyable added to a Map will have their Destroy() method called
// when the object is about to be removed. This replaces use of a finalizer.
type Destroyable interface {
Destroy()
}
// NewMap returns a new weak reference map
func NewMap[K comparable, T any]() *Map[K, T] {
res := &Map[K, T]{
m: make(map[K]*Ref[T]),
}
return res
}
// Get returns the value at index k in the map. If no such value exists, nil is returned.
func (w *Map[K, T]) Get(k K) *T {
w.l.RLock()
defer w.l.RUnlock()
v, ok := w.m[k]
if !ok {
return nil
}
return v.Get()
}
// Set inserts the value v if it does not already exists, and return it. If a value v
// already exists, then the previous value is returned.
func (w *Map[K, T]) Set(k K, v *T) *T {
w.l.Lock()
defer w.l.Unlock()
// already exists?
wr, ok := w.m[k]
if ok {
v2 := wr.Get()
if v2 != nil {
// return past (still alive) value
return v2
}
}
// store new value
wr = NewRefDestroyer(v, func(dv *T, wr *Ref[T]) {
w.destroy(wr, dv, k)
})
w.m[k] = wr
return v
}
// Delete removes element at key k from the map. This doesn't call Destroy immediately
// as this would typically happen when the object is actually cleared by the garbage
// collector and instances of said object may still be used.
func (w *Map[K, T]) Delete(k K) {
w.l.Lock()
defer w.l.Unlock()
delete(w.m, k)
}
func (w *Map[K, T]) destroy(wr *Ref[T], ptr *T, k K) {
w.l.Lock()
defer w.l.Unlock()
wr2, ok := w.m[k]
if !ok {
return
}
if wr == wr2 {
delete(w.m, k)
}
if v, ok := any(ptr).(Destroyable); ok {
go v.Destroy()
}
}
package weak
import (
"runtime"
"sync/atomic"
"unsafe"
)
// Ref is a weak reference to a Go object
type Ref[T any] struct {
hidden uintptr
state refState
}
func (wr *Ref[T]) value() *T {
v := atomic.LoadUintptr(&wr.hidden)
if v == 0 {
return nil
}
return (*T)(unsafe.Pointer(v))
}
// Get returns the value for a given weak reference pointer
func (wr *Ref[T]) Get() *T {
for {
if wr.state.CaS(refALIVE, refINUSE) {
val := wr.value()
// all good
wr.state.Set(refALIVE) // set back to alive
return val
}
if wr.state.Get() == refDEAD {
return nil
}
runtime.Gosched()
}
}
// NewRef returns a reference to the object v that may be cleared by the garbage collector
func NewRef[T any](v *T) *Ref[T] {
if v == nil {
return &Ref[T]{0, refDEAD}
}
wr := &Ref[T]{uintptr(unsafe.Pointer(v)), refALIVE}
var f func(p *T)
f = func(p *T) {
if wr.state.CaS(refALIVE, refDEAD) {
// we're now refdead, clear the pointer value
atomic.StoreUintptr(&wr.hidden, 0)
return
}
// this was not ALIVE, it means it was likely INUSE, re-set finalizer and wait
runtime.SetFinalizer(p, f)
}
runtime.SetFinalizer(v, f)
return wr
}
// NewRefDestroyer returns a reference to the object v that may be cleared by the garbage collector,
// in which case destroy will be called.
func NewRefDestroyer[T any](v *T, destroy func(v *T, wr *Ref[T])) *Ref[T] {
if v == nil {
return &Ref[T]{0, refDEAD}
}
wr := &Ref[T]{uintptr(unsafe.Pointer(v)), refALIVE}
var f func(p *T)
f = func(p *T) {
if wr.state.CaS(refALIVE, refDEAD) {
atomic.StoreUintptr(&wr.hidden, 0)
if destroy != nil {
go destroy(p, wr)
}
return
}
// this was not ALIVE, it means it was likely INUSE, re-set finalizer and wait
runtime.SetFinalizer(p, f)
}
runtime.SetFinalizer(v, f)
return wr
}
package weak
import "sync/atomic"
type refState uint32
const (
refDEAD refState = 0
refALIVE refState = 1
refINUSE refState = 2
)
func (wrS *refState) CaS(old, new refState) bool {
return atomic.CompareAndSwapUint32((*uint32)(wrS), uint32(old), uint32(new))
}
func (wrS *refState) Set(v refState) {
atomic.StoreUint32((*uint32)(wrS), uint32(v))
}
func (wrS *refState) Get() refState {
return refState(atomic.LoadUint32((*uint32)(wrS)))
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"unsafe"
"github.com/diamondburned/gotk4/pkg/core/gextras"
)
// #include <stdlib.h>
// #include <adwaita.h>
import "C"
// AboutDialogClass: instance of this type is always passed by reference.
type AboutDialogClass struct {
*aboutDialogClass
}
// aboutDialogClass is the struct that's finalized.
type aboutDialogClass struct {
native *C.AdwAboutDialogClass
}
func (a *AboutDialogClass) ParentClass() *DialogClass {
valptr := &a.native.parent_class
var _v *DialogClass // out
_v = (*DialogClass)(gextras.NewStructNative(unsafe.Pointer(valptr)))
return _v
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"unsafe"
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
)
// #include <stdlib.h>
// #include <adwaita.h>
import "C"
//export _gotk4_adw1_AboutDialog_ConnectActivateLink
func _gotk4_adw1_AboutDialog_ConnectActivateLink(arg0 C.gpointer, arg1 *C.gchar, arg2 C.guintptr) (cret C.gboolean) {
var f func(uri string) (ok bool)
{
closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2))
if closure == nil {
panic("given unknown closure user_data")
}
defer closure.TryRepanic()
f = closure.Func.(func(uri string) (ok bool))
}
var _uri string // out
_uri = C.GoString((*C.gchar)(unsafe.Pointer(arg1)))
ok := f(_uri)
var _ bool
if ok {
cret = C.TRUE
}
return cret
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"unsafe"
"github.com/diamondburned/gotk4/pkg/core/gextras"
)
// #include <stdlib.h>
// #include <adwaita.h>
import "C"
// AboutWindowClass: instance of this type is always passed by reference.
type AboutWindowClass struct {
*aboutWindowClass
}
// aboutWindowClass is the struct that's finalized.
type aboutWindowClass struct {
native *C.AdwAboutWindowClass
}
func (a *AboutWindowClass) ParentClass() *WindowClass {
valptr := &a.native.parent_class
var _v *WindowClass // out
_v = (*WindowClass)(gextras.NewStructNative(unsafe.Pointer(valptr)))
return _v
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"unsafe"
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
)
// #include <stdlib.h>
// #include <adwaita.h>
import "C"
//export _gotk4_adw1_AboutWindow_ConnectActivateLink
func _gotk4_adw1_AboutWindow_ConnectActivateLink(arg0 C.gpointer, arg1 *C.gchar, arg2 C.guintptr) (cret C.gboolean) {
var f func(uri string) (ok bool)
{
closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2))
if closure == nil {
panic("given unknown closure user_data")
}
defer closure.TryRepanic()
f = closure.Func.(func(uri string) (ok bool))
}
var _uri string // out
_uri = C.GoString((*C.gchar)(unsafe.Pointer(arg1)))
ok := f(_uri)
var _ bool
if ok {
cret = C.TRUE
}
return cret
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"fmt"
"runtime"
"unsafe"
"github.com/diamondburned/gotk4/pkg/core/gextras"
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
"github.com/diamondburned/gotk4/pkg/gdk/v4"
)
// #include <stdlib.h>
// #include <adwaita.h>
// #include <glib-object.h>
import "C"
// GType values.
var (
GTypeAccentColor = coreglib.Type(C.adw_accent_color_get_type())
)
func init() {
coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{
coreglib.TypeMarshaler{T: GTypeAccentColor, F: marshalAccentColor},
})
}
// AccentColor describes the available system accent colors.
type AccentColor C.gint
const (
// AccentColorBlue: use a blue color (#3584e4). This is the default value.
AccentColorBlue AccentColor = iota
// AccentColorTeal: use a teal color (#2190a4).
AccentColorTeal
// AccentColorGreen: use a green color (#3a944a).
AccentColorGreen
// AccentColorYellow: use a yellow color (#c88800).
AccentColorYellow
// AccentColorOrange: use a orange color (#ed5b00).
AccentColorOrange
// AccentColorRed: use a red color (#e62d42).
AccentColorRed
// AccentColorPink: use a pink color (#d56199).
AccentColorPink
// AccentColorPurple: use a purple color (#9141ac).
AccentColorPurple
// AccentColorSlate: use a slate color (#6f8396).
AccentColorSlate
)
func marshalAccentColor(p uintptr) (interface{}, error) {
return AccentColor(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil
}
// String returns the name in string for AccentColor.
func (a AccentColor) String() string {
switch a {
case AccentColorBlue:
return "Blue"
case AccentColorTeal:
return "Teal"
case AccentColorGreen:
return "Green"
case AccentColorYellow:
return "Yellow"
case AccentColorOrange:
return "Orange"
case AccentColorRed:
return "Red"
case AccentColorPink:
return "Pink"
case AccentColorPurple:
return "Purple"
case AccentColorSlate:
return "Slate"
default:
return fmt.Sprintf("AccentColor(%d)", a)
}
}
// AccentColorToRGBA converts self to a GdkRGBA representing its background
// color.
//
// The matching foreground color is white.
//
// The function takes the following parameters:
//
// - self: accent color.
//
// The function returns the following values:
//
// - rgba: return location for the color.
func AccentColorToRGBA(self AccentColor) *gdk.RGBA {
var _arg1 C.AdwAccentColor // out
var _arg2 C.GdkRGBA // in
_arg1 = C.AdwAccentColor(self)
C.adw_accent_color_to_rgba(_arg1, &_arg2)
runtime.KeepAlive(self)
var _rgba *gdk.RGBA // out
_rgba = (*gdk.RGBA)(gextras.NewStructNative(unsafe.Pointer((&_arg2))))
return _rgba
}
// AccentColorToStandaloneRGBA converts self to a GdkRGBA representing its
// standalone color.
//
// It will typically be darker for light background, and lighter for dark
// background, ensuring contrast.
//
// The function takes the following parameters:
//
// - self: accent color.
// - dark: whether to calculate standalone color for light or dark background.
//
// The function returns the following values:
//
// - rgba: return location for the color.
func AccentColorToStandaloneRGBA(self AccentColor, dark bool) *gdk.RGBA {
var _arg1 C.AdwAccentColor // out
var _arg2 C.gboolean // out
var _arg3 C.GdkRGBA // in
_arg1 = C.AdwAccentColor(self)
if dark {
_arg2 = C.TRUE
}
C.adw_accent_color_to_standalone_rgba(_arg1, _arg2, &_arg3)
runtime.KeepAlive(self)
runtime.KeepAlive(dark)
var _rgba *gdk.RGBA // out
_rgba = (*gdk.RGBA)(gextras.NewStructNative(unsafe.Pointer((&_arg3))))
return _rgba
}
// RGBAToStandalone adjusts rgba to be suitable as a standalone color.
//
// It will typically be darker for light background, and lighter for dark
// background, ensuring contrast.
//
// The function takes the following parameters:
//
// - rgba: background color.
// - dark: whether to calculate standalone color for light or dark background.
//
// The function returns the following values:
//
// - standaloneRgba: return location for the standalone color.
func RGBAToStandalone(rgba *gdk.RGBA, dark bool) *gdk.RGBA {
var _arg1 *C.GdkRGBA // out
var _arg2 C.gboolean // out
var _arg3 C.GdkRGBA // in
_arg1 = (*C.GdkRGBA)(gextras.StructNative(unsafe.Pointer(rgba)))
if dark {
_arg2 = C.TRUE
}
C.adw_rgba_to_standalone(_arg1, _arg2, &_arg3)
runtime.KeepAlive(rgba)
runtime.KeepAlive(dark)
var _standaloneRgba *gdk.RGBA // out
_standaloneRgba = (*gdk.RGBA)(gextras.NewStructNative(unsafe.Pointer((&_arg3))))
return _standaloneRgba
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
)
// #include <stdlib.h>
// #include <adwaita.h>
import "C"
//export _gotk4_adw1_ActionRow_ConnectActivated
func _gotk4_adw1_ActionRow_ConnectActivated(arg0 C.gpointer, arg1 C.guintptr) {
var f func()
{
closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1))
if closure == nil {
panic("given unknown closure user_data")
}
defer closure.TryRepanic()
f = closure.Func.(func())
}
f()
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"unsafe"
"github.com/diamondburned/gotk4/pkg/core/gextras"
)
// #include <stdlib.h>
// #include <adwaita.h>
import "C"
// AlertDialogClass: instance of this type is always passed by reference.
type AlertDialogClass struct {
*alertDialogClass
}
// alertDialogClass is the struct that's finalized.
type alertDialogClass struct {
native *C.AdwAlertDialogClass
}
func (a *AlertDialogClass) ParentClass() *DialogClass {
valptr := &a.native.parent_class
var _v *DialogClass // out
_v = (*DialogClass)(gextras.NewStructNative(unsafe.Pointer(valptr)))
return _v
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"fmt"
"unsafe"
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
)
// #include <stdlib.h>
// #include <adwaita.h>
// #include <glib-object.h>
import "C"
// GType values.
var (
GTypeResponseAppearance = coreglib.Type(C.adw_response_appearance_get_type())
)
func init() {
coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{
coreglib.TypeMarshaler{T: GTypeResponseAppearance, F: marshalResponseAppearance},
})
}
// ResponseAppearance describes the possible styles of alertdialog response
// buttons.
//
// See alertdialog.SetResponseAppearance.
type ResponseAppearance C.gint
const (
// ResponseDefault: default appearance.
ResponseDefault ResponseAppearance = iota
// ResponseSuggested: used to denote important responses such as the
// affirmative action.
ResponseSuggested
// ResponseDestructive: used to draw attention to the potentially damaging
// consequences of using the response. This appearance acts as a warning to
// the user.
ResponseDestructive
)
func marshalResponseAppearance(p uintptr) (interface{}, error) {
return ResponseAppearance(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil
}
// String returns the name in string for ResponseAppearance.
func (r ResponseAppearance) String() string {
switch r {
case ResponseDefault:
return "Default"
case ResponseSuggested:
return "Suggested"
case ResponseDestructive:
return "Destructive"
default:
return fmt.Sprintf("ResponseAppearance(%d)", r)
}
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"unsafe"
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
)
// #include <stdlib.h>
// #include <adwaita.h>
import "C"
//export _gotk4_adw1_AlertDialog_ConnectResponse
func _gotk4_adw1_AlertDialog_ConnectResponse(arg0 C.gpointer, arg1 *C.gchar, arg2 C.guintptr) {
var f func(response string)
{
closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2))
if closure == nil {
panic("given unknown closure user_data")
}
defer closure.TryRepanic()
f = closure.Func.(func(response string))
}
var _response string // out
_response = C.GoString((*C.gchar)(unsafe.Pointer(arg1)))
f(_response)
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"runtime"
"unsafe"
"github.com/diamondburned/gotk4/pkg/core/gbox"
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
)
// #include <stdlib.h>
// #include <adwaita.h>
// #include <glib-object.h>
// extern void callbackDelete(gpointer);
// extern void _gotk4_adw1_AnimationTargetFunc(double, gpointer);
import "C"
// GType values.
var (
GTypeAnimationTarget = coreglib.Type(C.adw_animation_target_get_type())
GTypeCallbackAnimationTarget = coreglib.Type(C.adw_callback_animation_target_get_type())
)
func init() {
coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{
coreglib.TypeMarshaler{T: GTypeAnimationTarget, F: marshalAnimationTarget},
coreglib.TypeMarshaler{T: GTypeCallbackAnimationTarget, F: marshalCallbackAnimationTarget},
})
}
// AnimationTargetFunc: prototype for animation targets based on user callbacks.
type AnimationTargetFunc func(value float64)
// AnimationTarget represents a value animation can animate.
type AnimationTarget struct {
_ [0]func() // equal guard
*coreglib.Object
}
var (
_ coreglib.Objector = (*AnimationTarget)(nil)
)
// AnimationTargetter describes types inherited from class AnimationTarget.
//
// To get the original type, the caller must assert this to an interface or
// another type.
type AnimationTargetter interface {
coreglib.Objector
baseAnimationTarget() *AnimationTarget
}
var _ AnimationTargetter = (*AnimationTarget)(nil)
func wrapAnimationTarget(obj *coreglib.Object) *AnimationTarget {
return &AnimationTarget{
Object: obj,
}
}
func marshalAnimationTarget(p uintptr) (interface{}, error) {
return wrapAnimationTarget(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil
}
func (v *AnimationTarget) baseAnimationTarget() *AnimationTarget {
return v
}
// BaseAnimationTarget returns the underlying base object.
func BaseAnimationTarget(obj AnimationTargetter) *AnimationTarget {
return obj.baseAnimationTarget()
}
// CallbackAnimationTarget: animationtarget that calls a given callback during
// the animation.
type CallbackAnimationTarget struct {
_ [0]func() // equal guard
AnimationTarget
}
var (
_ AnimationTargetter = (*CallbackAnimationTarget)(nil)
)
func wrapCallbackAnimationTarget(obj *coreglib.Object) *CallbackAnimationTarget {
return &CallbackAnimationTarget{
AnimationTarget: AnimationTarget{
Object: obj,
},
}
}
func marshalCallbackAnimationTarget(p uintptr) (interface{}, error) {
return wrapCallbackAnimationTarget(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil
}
// NewCallbackAnimationTarget creates a new AdwAnimationTarget that calls the
// given callback during the animation.
//
// The function takes the following parameters:
//
// - callback to call.
//
// The function returns the following values:
//
// - callbackAnimationTarget: newly created callback target.
func NewCallbackAnimationTarget(callback AnimationTargetFunc) *CallbackAnimationTarget {
var _arg1 C.AdwAnimationTargetFunc // out
var _arg2 C.gpointer
var _arg3 C.GDestroyNotify
var _cret *C.AdwAnimationTarget // in
_arg1 = (*[0]byte)(C._gotk4_adw1_AnimationTargetFunc)
_arg2 = C.gpointer(gbox.Assign(callback))
_arg3 = (C.GDestroyNotify)((*[0]byte)(C.callbackDelete))
_cret = C.adw_callback_animation_target_new(_arg1, _arg2, _arg3)
runtime.KeepAlive(callback)
var _callbackAnimationTarget *CallbackAnimationTarget // out
_callbackAnimationTarget = wrapCallbackAnimationTarget(coreglib.AssumeOwnership(unsafe.Pointer(_cret)))
return _callbackAnimationTarget
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"runtime"
"unsafe"
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
)
// #include <stdlib.h>
// #include <adwaita.h>
// #include <glib-object.h>
import "C"
// GType values.
var (
GTypePropertyAnimationTarget = coreglib.Type(C.adw_property_animation_target_get_type())
)
func init() {
coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{
coreglib.TypeMarshaler{T: GTypePropertyAnimationTarget, F: marshalPropertyAnimationTarget},
})
}
// PropertyAnimationTarget: animationtarget changing the value of a property of
// a gobject.Object instance.
type PropertyAnimationTarget struct {
_ [0]func() // equal guard
AnimationTarget
}
var (
_ AnimationTargetter = (*PropertyAnimationTarget)(nil)
)
func wrapPropertyAnimationTarget(obj *coreglib.Object) *PropertyAnimationTarget {
return &PropertyAnimationTarget{
AnimationTarget: AnimationTarget{
Object: obj,
},
}
}
func marshalPropertyAnimationTarget(p uintptr) (interface{}, error) {
return wrapPropertyAnimationTarget(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil
}
// NewPropertyAnimationTarget creates a new AdwPropertyAnimationTarget for the
// property_name property on object.
//
// The function takes the following parameters:
//
// - object to be animated.
// - propertyName: name of the property on object to animate.
//
// The function returns the following values:
//
// - propertyAnimationTarget: newly created AdwPropertyAnimationTarget.
func NewPropertyAnimationTarget(object *coreglib.Object, propertyName string) *PropertyAnimationTarget {
var _arg1 *C.GObject // out
var _arg2 *C.char // out
var _cret *C.AdwAnimationTarget // in
_arg1 = (*C.GObject)(unsafe.Pointer(object.Native()))
_arg2 = (*C.char)(unsafe.Pointer(C.CString(propertyName)))
defer C.free(unsafe.Pointer(_arg2))
_cret = C.adw_property_animation_target_new(_arg1, _arg2)
runtime.KeepAlive(object)
runtime.KeepAlive(propertyName)
var _propertyAnimationTarget *PropertyAnimationTarget // out
_propertyAnimationTarget = wrapPropertyAnimationTarget(coreglib.AssumeOwnership(unsafe.Pointer(_cret)))
return _propertyAnimationTarget
}
// Object gets the object animated by self.
//
// The AdwPropertyAnimationTarget instance does not hold a strong reference
// on the object; make sure the object is kept alive throughout the target's
// lifetime.
//
// The function returns the following values:
//
// - object: animated object.
func (self *PropertyAnimationTarget) Object() *coreglib.Object {
var _arg0 *C.AdwPropertyAnimationTarget // out
var _cret *C.GObject // in
_arg0 = (*C.AdwPropertyAnimationTarget)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_cret = C.adw_property_animation_target_get_object(_arg0)
runtime.KeepAlive(self)
var _object *coreglib.Object // out
_object = coreglib.Take(unsafe.Pointer(_cret))
return _object
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"github.com/diamondburned/gotk4/pkg/core/gbox"
)
// #include <stdlib.h>
// #include <adwaita.h>
import "C"
//export _gotk4_adw1_AnimationTargetFunc
func _gotk4_adw1_AnimationTargetFunc(arg1 C.double, arg2 C.gpointer) {
var fn AnimationTargetFunc
{
v := gbox.Get(uintptr(arg2))
if v == nil {
panic(`callback not found`)
}
fn = v.(AnimationTargetFunc)
}
var _value float64 // out
_value = float64(arg1)
fn(_value)
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"runtime"
"unsafe"
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
"github.com/diamondburned/gotk4/pkg/gtk/v4"
)
// #include <stdlib.h>
// #include <adwaita.h>
import "C"
// GetEnableAnimations checks whether animations are enabled for widget.
//
// This should be used when implementing an animated widget to know whether to
// animate it or not.
//
// The function takes the following parameters:
//
// - widget: GtkWidget.
//
// The function returns the following values:
//
// - ok: whether animations are enabled for widget.
func GetEnableAnimations(widget gtk.Widgetter) bool {
var _arg1 *C.GtkWidget // out
var _cret C.gboolean // in
_arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(widget).Native()))
_cret = C.adw_get_enable_animations(_arg1)
runtime.KeepAlive(widget)
var _ok bool // out
if _cret != 0 {
_ok = true
}
return _ok
}
// Lerp computes the linear interpolation between a and b for t.
//
// The function takes the following parameters:
//
// - a: start.
// - b: end.
// - t: interpolation rate.
//
// The function returns the following values:
//
// - gdouble: computed value.
func Lerp(a, b, t float64) float64 {
var _arg1 C.double // out
var _arg2 C.double // out
var _arg3 C.double // out
var _cret C.double // in
_arg1 = C.double(a)
_arg2 = C.double(b)
_arg3 = C.double(t)
_cret = C.adw_lerp(_arg1, _arg2, _arg3)
runtime.KeepAlive(a)
runtime.KeepAlive(b)
runtime.KeepAlive(t)
var _gdouble float64 // out
_gdouble = float64(_cret)
return _gdouble
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
)
// #include <stdlib.h>
// #include <adwaita.h>
import "C"
//export _gotk4_adw1_Animation_ConnectDone
func _gotk4_adw1_Animation_ConnectDone(arg0 C.gpointer, arg1 C.guintptr) {
var f func()
{
closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1))
if closure == nil {
panic("given unknown closure user_data")
}
defer closure.TryRepanic()
f = closure.Func.(func())
}
f()
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"runtime"
"unsafe"
"github.com/diamondburned/gotk4/pkg/core/gextras"
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
"github.com/diamondburned/gotk4/pkg/gio/v2"
"github.com/diamondburned/gotk4/pkg/gtk/v4"
)
// #include <stdlib.h>
// #include <adwaita.h>
// #include <glib-object.h>
import "C"
// GType values.
var (
GTypeApplication = coreglib.Type(C.adw_application_get_type())
)
func init() {
coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{
coreglib.TypeMarshaler{T: GTypeApplication, F: marshalApplication},
})
}
// ApplicationOverrides contains methods that are overridable.
type ApplicationOverrides struct {
}
func defaultApplicationOverrides(v *Application) ApplicationOverrides {
return ApplicationOverrides{}
}
// Application: base class for Adwaita applications.
//
// AdwApplication handles library initialization by calling init in the default
// gio.Application::startup signal handler, in turn chaining up as required
// by gtk.Application. Therefore, any subclass of AdwApplication should always
// chain up its startup handler before using any Adwaita or GTK API.
//
// # Automatic Resources
//
// AdwApplication will automatically load stylesheets located in the
// application's resource base path (see gio.Application.SetResourceBasePath(),
// if they're present.
//
// They can be used to add custom styles to the application, as follows:
//
// - style.css contains styles that are always present.
//
// - style-dark.css contains styles only used when stylemanager:dark is TRUE.
//
// - style-hc.css contains styles used when the system high contrast preference
// is enabled.
//
// - style-hc-dark.css contains styles used when the system high contrast
// preference is enabled and stylemanager:dark is TRUE.
type Application struct {
_ [0]func() // equal guard
gtk.Application
}
var (
_ coreglib.Objector = (*Application)(nil)
)
func init() {
coreglib.RegisterClassInfo[*Application, *ApplicationClass, ApplicationOverrides](
GTypeApplication,
initApplicationClass,
wrapApplication,
defaultApplicationOverrides,
)
}
func initApplicationClass(gclass unsafe.Pointer, overrides ApplicationOverrides, classInitFunc func(*ApplicationClass)) {
if classInitFunc != nil {
class := (*ApplicationClass)(gextras.NewStructNative(gclass))
classInitFunc(class)
}
}
func wrapApplication(obj *coreglib.Object) *Application {
return &Application{
Application: gtk.Application{
Application: gio.Application{
Object: obj,
ActionGroup: gio.ActionGroup{
Object: obj,
},
ActionMap: gio.ActionMap{
Object: obj,
},
},
},
}
}
func marshalApplication(p uintptr) (interface{}, error) {
return wrapApplication(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil
}
// NewApplication creates a new AdwApplication.
//
// If application_id is not NULL, then it must be valid. See
// gio.Application().IDIsValid.
//
// If no application ID is given then some features (most notably application
// uniqueness) will be disabled.
//
// The function takes the following parameters:
//
// - applicationId (optional): application ID.
// - flags: application flags.
//
// The function returns the following values:
//
// - application: newly created AdwApplication.
func NewApplication(applicationId string, flags gio.ApplicationFlags) *Application {
var _arg1 *C.char // out
var _arg2 C.GApplicationFlags // out
var _cret *C.AdwApplication // in
if applicationId != "" {
_arg1 = (*C.char)(unsafe.Pointer(C.CString(applicationId)))
defer C.free(unsafe.Pointer(_arg1))
}
_arg2 = C.GApplicationFlags(flags)
_cret = C.adw_application_new(_arg1, _arg2)
runtime.KeepAlive(applicationId)
runtime.KeepAlive(flags)
var _application *Application // out
_application = wrapApplication(coreglib.AssumeOwnership(unsafe.Pointer(_cret)))
return _application
}
// StyleManager gets the style manager for self.
//
// This is a convenience property allowing to access AdwStyleManager through
// property bindings or expressions.
//
// The function returns the following values:
//
// - styleManager: style manager.
func (self *Application) StyleManager() *StyleManager {
var _arg0 *C.AdwApplication // out
var _cret *C.AdwStyleManager // in
_arg0 = (*C.AdwApplication)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_cret = C.adw_application_get_style_manager(_arg0)
runtime.KeepAlive(self)
var _styleManager *StyleManager // out
_styleManager = wrapStyleManager(coreglib.Take(unsafe.Pointer(_cret)))
return _styleManager
}
// ApplicationClass: instance of this type is always passed by reference.
type ApplicationClass struct {
*applicationClass
}
// applicationClass is the struct that's finalized.
type applicationClass struct {
native *C.AdwApplicationClass
}
// ParentClass: parent class.
func (a *ApplicationClass) ParentClass() *gtk.ApplicationClass {
valptr := &a.native.parent_class
var _v *gtk.ApplicationClass // out
_v = (*gtk.ApplicationClass)(gextras.NewStructNative(unsafe.Pointer(valptr)))
return _v
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"unsafe"
"github.com/diamondburned/gotk4/pkg/core/gextras"
"github.com/diamondburned/gotk4/pkg/gtk/v4"
)
// #include <stdlib.h>
// #include <adwaita.h>
import "C"
// BannerClass: instance of this type is always passed by reference.
type BannerClass struct {
*bannerClass
}
// bannerClass is the struct that's finalized.
type bannerClass struct {
native *C.AdwBannerClass
}
func (b *BannerClass) ParentClass() *gtk.WidgetClass {
valptr := &b.native.parent_class
var _v *gtk.WidgetClass // out
_v = (*gtk.WidgetClass)(gextras.NewStructNative(unsafe.Pointer(valptr)))
return _v
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"fmt"
"unsafe"
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
)
// #include <stdlib.h>
// #include <adwaita.h>
// #include <glib-object.h>
import "C"
// GType values.
var (
GTypeBannerButtonStyle = coreglib.Type(C.adw_banner_button_style_get_type())
)
func init() {
coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{
coreglib.TypeMarshaler{T: GTypeBannerButtonStyle, F: marshalBannerButtonStyle},
})
}
// BannerButtonStyle describes the available button styles for banner.
//
// New values may be added to this enumeration over time.
//
// See banner:button-style.
type BannerButtonStyle C.gint
const (
// BannerButtonDefault: default button style.
BannerButtonDefault BannerButtonStyle = iota
// BannerButtonSuggested: button in the suggested action style.
BannerButtonSuggested
)
func marshalBannerButtonStyle(p uintptr) (interface{}, error) {
return BannerButtonStyle(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil
}
// String returns the name in string for BannerButtonStyle.
func (b BannerButtonStyle) String() string {
switch b {
case BannerButtonDefault:
return "Default"
case BannerButtonSuggested:
return "Suggested"
default:
return fmt.Sprintf("BannerButtonStyle(%d)", b)
}
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
)
// #include <stdlib.h>
// #include <adwaita.h>
import "C"
//export _gotk4_adw1_Banner_ConnectButtonClicked
func _gotk4_adw1_Banner_ConnectButtonClicked(arg0 C.gpointer, arg1 C.guintptr) {
var f func()
{
closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1))
if closure == nil {
panic("given unknown closure user_data")
}
defer closure.TryRepanic()
f = closure.Func.(func())
}
f()
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"runtime"
"unsafe"
"github.com/diamondburned/gotk4/pkg/core/gextras"
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
"github.com/diamondburned/gotk4/pkg/gtk/v4"
)
// #include <stdlib.h>
// #include <adwaita.h>
// #include <glib-object.h>
import "C"
// GType values.
var (
GTypeBin = coreglib.Type(C.adw_bin_get_type())
)
func init() {
coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{
coreglib.TypeMarshaler{T: GTypeBin, F: marshalBin},
})
}
// BinOverrides contains methods that are overridable.
type BinOverrides struct {
}
func defaultBinOverrides(v *Bin) BinOverrides {
return BinOverrides{}
}
// Bin: widget with one child.
//
// <picture> <source srcset="bin-dark.png" media="(prefers-color-scheme: dark)">
// <img src="bin.png" alt="bin"> </picture>
//
// The AdwBin widget has only one child, set with the bin:child property.
//
// It is useful for deriving subclasses, since it provides common code needed
// for handling a single child widget.
type Bin struct {
_ [0]func() // equal guard
gtk.Widget
}
var (
_ gtk.Widgetter = (*Bin)(nil)
)
func init() {
coreglib.RegisterClassInfo[*Bin, *BinClass, BinOverrides](
GTypeBin,
initBinClass,
wrapBin,
defaultBinOverrides,
)
}
func initBinClass(gclass unsafe.Pointer, overrides BinOverrides, classInitFunc func(*BinClass)) {
if classInitFunc != nil {
class := (*BinClass)(gextras.NewStructNative(gclass))
classInitFunc(class)
}
}
func wrapBin(obj *coreglib.Object) *Bin {
return &Bin{
Widget: gtk.Widget{
InitiallyUnowned: coreglib.InitiallyUnowned{
Object: obj,
},
Object: obj,
Accessible: gtk.Accessible{
Object: obj,
},
Buildable: gtk.Buildable{
Object: obj,
},
ConstraintTarget: gtk.ConstraintTarget{
Object: obj,
},
},
}
}
func marshalBin(p uintptr) (interface{}, error) {
return wrapBin(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil
}
// NewBin creates a new AdwBin.
//
// The function returns the following values:
//
// - bin: new created AdwBin.
func NewBin() *Bin {
var _cret *C.GtkWidget // in
_cret = C.adw_bin_new()
var _bin *Bin // out
_bin = wrapBin(coreglib.Take(unsafe.Pointer(_cret)))
return _bin
}
// Child gets the child widget of self.
//
// The function returns the following values:
//
// - widget (optional): child widget of self.
func (self *Bin) Child() gtk.Widgetter {
var _arg0 *C.AdwBin // out
var _cret *C.GtkWidget // in
_arg0 = (*C.AdwBin)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_cret = C.adw_bin_get_child(_arg0)
runtime.KeepAlive(self)
var _widget gtk.Widgetter // out
if _cret != nil {
{
objptr := unsafe.Pointer(_cret)
object := coreglib.Take(objptr)
casted := object.WalkCast(func(obj coreglib.Objector) bool {
_, ok := obj.(gtk.Widgetter)
return ok
})
rv, ok := casted.(gtk.Widgetter)
if !ok {
panic("no marshaler for " + object.TypeFromInstance().String() + " matching gtk.Widgetter")
}
_widget = rv
}
}
return _widget
}
// SetChild sets the child widget of self.
//
// The function takes the following parameters:
//
// - child (optional) widget.
func (self *Bin) SetChild(child gtk.Widgetter) {
var _arg0 *C.AdwBin // out
var _arg1 *C.GtkWidget // out
_arg0 = (*C.AdwBin)(unsafe.Pointer(coreglib.InternObject(self).Native()))
if child != nil {
_arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(child).Native()))
}
C.adw_bin_set_child(_arg0, _arg1)
runtime.KeepAlive(self)
runtime.KeepAlive(child)
}
// BinClass: instance of this type is always passed by reference.
type BinClass struct {
*binClass
}
// binClass is the struct that's finalized.
type binClass struct {
native *C.AdwBinClass
}
func (b *BinClass) ParentClass() *gtk.WidgetClass {
valptr := &b.native.parent_class
var _v *gtk.WidgetClass // out
_v = (*gtk.WidgetClass)(gextras.NewStructNative(unsafe.Pointer(valptr)))
return _v
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"unsafe"
"github.com/diamondburned/gotk4/pkg/core/gextras"
"github.com/diamondburned/gotk4/pkg/gtk/v4"
)
// #include <stdlib.h>
// #include <adwaita.h>
import "C"
// BottomSheetClass: instance of this type is always passed by reference.
type BottomSheetClass struct {
*bottomSheetClass
}
// bottomSheetClass is the struct that's finalized.
type bottomSheetClass struct {
native *C.AdwBottomSheetClass
}
func (b *BottomSheetClass) ParentClass() *gtk.WidgetClass {
valptr := &b.native.parent_class
var _v *gtk.WidgetClass // out
_v = (*gtk.WidgetClass)(gextras.NewStructNative(unsafe.Pointer(valptr)))
return _v
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
)
// #include <stdlib.h>
// #include <adwaita.h>
import "C"
//export _gotk4_adw1_BottomSheet_ConnectCloseAttempt
func _gotk4_adw1_BottomSheet_ConnectCloseAttempt(arg0 C.gpointer, arg1 C.guintptr) {
var f func()
{
closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1))
if closure == nil {
panic("given unknown closure user_data")
}
defer closure.TryRepanic()
f = closure.Func.(func())
}
f()
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"unsafe"
"github.com/diamondburned/gotk4/pkg/core/gextras"
"github.com/diamondburned/gotk4/pkg/gtk/v4"
)
// #include <stdlib.h>
// #include <adwaita.h>
import "C"
// BreakpointBinClass: instance of this type is always passed by reference.
type BreakpointBinClass struct {
*breakpointBinClass
}
// breakpointBinClass is the struct that's finalized.
type breakpointBinClass struct {
native *C.AdwBreakpointBinClass
}
func (b *BreakpointBinClass) ParentClass() *gtk.WidgetClass {
valptr := &b.native.parent_class
var _v *gtk.WidgetClass // out
_v = (*gtk.WidgetClass)(gextras.NewStructNative(unsafe.Pointer(valptr)))
return _v
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"runtime"
"unsafe"
"github.com/diamondburned/gotk4/pkg/core/gextras"
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
"github.com/diamondburned/gotk4/pkg/gtk/v4"
)
// #include <stdlib.h>
// #include <adwaita.h>
// #include <glib-object.h>
import "C"
// GType values.
var (
GTypeBreakpointBin = coreglib.Type(C.adw_breakpoint_bin_get_type())
)
func init() {
coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{
coreglib.TypeMarshaler{T: GTypeBreakpointBin, F: marshalBreakpointBin},
})
}
// BreakpointBinOverrides contains methods that are overridable.
type BreakpointBinOverrides struct {
}
func defaultBreakpointBinOverrides(v *BreakpointBin) BreakpointBinOverrides {
return BreakpointBinOverrides{}
}
// BreakpointBin: widget that changes layout based on available size.
//
// <picture> <source srcset="breakpoint-bin-dark.png"
// media="(prefers-color-scheme: dark)"> <img src="breakpoint-bin.png"
// alt="breakpoint-bin"> </picture>
//
// AdwBreakpointBin provides a way to use breakpoints without window,
// applicationwindow or dialog. It can be useful for limiting breakpoints to a
// single page and similar purposes. Most applications shouldn't need it.
//
// AdwBreakpointBin is similar to bin. It has one child, set via the
// breakpointbin:child property.
//
// When AdwBreakpointBin is resized, its child widget can rearrange its layout
// at specific thresholds.
//
// The thresholds and layout changes are defined via breakpoint objects.
// They can be added using breakpointbin.AddBreakpoint.
//
// Each breakpoint has a condition, specifying the bin's size and/or aspect
// ratio, and setters that automatically set object properties when that
// happens. The breakpoint::apply and breakpoint::unapply can be used instead
// for more complex scenarios.
//
// Breakpoints are only allowed to modify widgets inside the AdwBreakpointBin,
// but not on the AdwBreakpointBin itself or any other widgets.
//
// If multiple breakpoints can be used for the current size, the last
// one is always picked. The current breakpoint can be tracked using the
// breakpointbin:current-breakpoint property.
//
// If none of the breakpoints can be used, that property will be set to NULL,
// and the original property values will be used instead.
//
// # Minimum Size
//
// Adding a breakpoint to AdwBreakpointBin will result in it having no minimum
// size. The gtk.Widget:width-request and gtk.Widget:height-request properties
// must always be set when using breakpoints, indicating the smallest size you
// want to support.
//
// The minimum size and breakpoint conditions must be carefully selected so
// that the child widget completely fits. If it doesn't, it will overflow and a
// warning message will be printed.
//
// When choosing minimum size, consider translations and text scale factor
// changes. Make sure to leave enough space for text labels, and enable
// ellipsizing or wrapping if they might not fit.
//
// For gtk.Label this can be done via gtk.Label:ellipsize, or via gtk.Label:wrap
// together with gtk.Label:wrap-mode.
//
// For buttons, use gtk.Button:can-shrink, gtk.MenuButton:can-shrink,
// adw.SplitButton:can-shrink, or adw.ButtonContent:can-shrink.
//
// Example
//
// GtkWidget *bin, *child;
// AdwBreakpoint *breakpoint;
//
// bin = adw_breakpoint_bin_new ();
// gtk_widget_set_size_request (bin, 150, 150);
//
// child = gtk_label_new ("Wide");
// gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
// gtk_widget_add_css_class (child, "title-1");
// adw_breakpoint_bin_set_child (ADW_BREAKPOINT_BIN (bin), child);
//
// breakpoint = adw_breakpoint_new (adw_breakpoint_condition_parse ("max-width: 200px"));
// adw_breakpoint_add_setters (breakpoint,
// G_OBJECT (child), "label", "Narrow",
// NULL);
// adw_breakpoint_bin_add_breakpoint (ADW_BREAKPOINT_BIN (bin), breakpoint);
//
// The bin has a single label inside it, displaying "Wide". When the bin's width
// is smaller than or equal to 200px, it changes to "Narrow".
//
// # AdwBreakpointBin as GtkBuildable
//
// AdwBreakpointBin allows adding AdwBreakpoint objects as children.
//
// Example of an AdwBreakpointBin UI definition:
//
// <object class="AdwBreakpointBin">
// <property name="width-request">150</property>
// <property name="height-request">150</property>
// <property name="child">
// <object class="GtkLabel" id="child">
// <property name="label">Wide</property>
// <property name="ellipsize">end</property>
// <style>
// <class name="title-1"/>
// </style>
// </object>
// </property>
// <child>
// <object class="AdwBreakpoint">
// <condition>max-width: 200px</condition>
// <setter object="child" property="label">Narrow</setter>
// </object>
// </child>
// </object>
//
// See breakpoint documentation for details.
type BreakpointBin struct {
_ [0]func() // equal guard
gtk.Widget
}
var (
_ gtk.Widgetter = (*BreakpointBin)(nil)
)
func init() {
coreglib.RegisterClassInfo[*BreakpointBin, *BreakpointBinClass, BreakpointBinOverrides](
GTypeBreakpointBin,
initBreakpointBinClass,
wrapBreakpointBin,
defaultBreakpointBinOverrides,
)
}
func initBreakpointBinClass(gclass unsafe.Pointer, overrides BreakpointBinOverrides, classInitFunc func(*BreakpointBinClass)) {
if classInitFunc != nil {
class := (*BreakpointBinClass)(gextras.NewStructNative(gclass))
classInitFunc(class)
}
}
func wrapBreakpointBin(obj *coreglib.Object) *BreakpointBin {
return &BreakpointBin{
Widget: gtk.Widget{
InitiallyUnowned: coreglib.InitiallyUnowned{
Object: obj,
},
Object: obj,
Accessible: gtk.Accessible{
Object: obj,
},
Buildable: gtk.Buildable{
Object: obj,
},
ConstraintTarget: gtk.ConstraintTarget{
Object: obj,
},
},
}
}
func marshalBreakpointBin(p uintptr) (interface{}, error) {
return wrapBreakpointBin(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil
}
// NewBreakpointBin creates a new AdwBreakpointBin.
//
// The function returns the following values:
//
// - breakpointBin: newly created AdwBreakpointBin.
func NewBreakpointBin() *BreakpointBin {
var _cret *C.GtkWidget // in
_cret = C.adw_breakpoint_bin_new()
var _breakpointBin *BreakpointBin // out
_breakpointBin = wrapBreakpointBin(coreglib.Take(unsafe.Pointer(_cret)))
return _breakpointBin
}
// AddBreakpoint adds breakpoint to self.
//
// The function takes the following parameters:
//
// - breakpoint to add.
func (self *BreakpointBin) AddBreakpoint(breakpoint *Breakpoint) {
var _arg0 *C.AdwBreakpointBin // out
var _arg1 *C.AdwBreakpoint // out
_arg0 = (*C.AdwBreakpointBin)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_arg1 = (*C.AdwBreakpoint)(unsafe.Pointer(coreglib.InternObject(breakpoint).Native()))
C.g_object_ref(C.gpointer(coreglib.InternObject(breakpoint).Native()))
C.adw_breakpoint_bin_add_breakpoint(_arg0, _arg1)
runtime.KeepAlive(self)
runtime.KeepAlive(breakpoint)
}
// Child gets the child widget of self.
//
// The function returns the following values:
//
// - widget (optional): child widget of self.
func (self *BreakpointBin) Child() gtk.Widgetter {
var _arg0 *C.AdwBreakpointBin // out
var _cret *C.GtkWidget // in
_arg0 = (*C.AdwBreakpointBin)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_cret = C.adw_breakpoint_bin_get_child(_arg0)
runtime.KeepAlive(self)
var _widget gtk.Widgetter // out
if _cret != nil {
{
objptr := unsafe.Pointer(_cret)
object := coreglib.Take(objptr)
casted := object.WalkCast(func(obj coreglib.Objector) bool {
_, ok := obj.(gtk.Widgetter)
return ok
})
rv, ok := casted.(gtk.Widgetter)
if !ok {
panic("no marshaler for " + object.TypeFromInstance().String() + " matching gtk.Widgetter")
}
_widget = rv
}
}
return _widget
}
// CurrentBreakpoint gets the current breakpoint.
//
// The function returns the following values:
//
// - breakpoint (optional): current breakpoint.
func (self *BreakpointBin) CurrentBreakpoint() *Breakpoint {
var _arg0 *C.AdwBreakpointBin // out
var _cret *C.AdwBreakpoint // in
_arg0 = (*C.AdwBreakpointBin)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_cret = C.adw_breakpoint_bin_get_current_breakpoint(_arg0)
runtime.KeepAlive(self)
var _breakpoint *Breakpoint // out
if _cret != nil {
_breakpoint = wrapBreakpoint(coreglib.Take(unsafe.Pointer(_cret)))
}
return _breakpoint
}
// RemoveBreakpoint removes breakpoint from self.
//
// The function takes the following parameters:
//
// - breakpoint to remove.
func (self *BreakpointBin) RemoveBreakpoint(breakpoint *Breakpoint) {
var _arg0 *C.AdwBreakpointBin // out
var _arg1 *C.AdwBreakpoint // out
_arg0 = (*C.AdwBreakpointBin)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_arg1 = (*C.AdwBreakpoint)(unsafe.Pointer(coreglib.InternObject(breakpoint).Native()))
C.adw_breakpoint_bin_remove_breakpoint(_arg0, _arg1)
runtime.KeepAlive(self)
runtime.KeepAlive(breakpoint)
}
// SetChild sets the child widget of self.
//
// The function takes the following parameters:
//
// - child (optional) widget.
func (self *BreakpointBin) SetChild(child gtk.Widgetter) {
var _arg0 *C.AdwBreakpointBin // out
var _arg1 *C.GtkWidget // out
_arg0 = (*C.AdwBreakpointBin)(unsafe.Pointer(coreglib.InternObject(self).Native()))
if child != nil {
_arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(child).Native()))
}
C.adw_breakpoint_bin_set_child(_arg0, _arg1)
runtime.KeepAlive(self)
runtime.KeepAlive(child)
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"github.com/diamondburned/gotk4/pkg/glib/v2"
)
// #include <stdlib.h>
// #include <adwaita.h>
import "C"
// AddSetter adds a setter to self.
//
// The setter will automatically set property on object to value when applying
// the breakpoint, and set it back to its original value upon unapplying it.
//
// Note that setting properties to their original values does not work for
// properties that have irreversible side effects. For example, changing
// gtk.Button:label while gtk.Button:icon-name is set will reset the icon.
// However, resetting the label will not set icon-name to its original value.
//
// Use the breakpoint::apply and breakpoint::unapply signals for those
// properties instead.
//
// The function takes the following parameters:
//
// - object: target object.
// - property: target property.
// - value to set.
//
func (self *Breakpoint) AddSetter(object glib.Objector, property string, value any) {
self.AddSetterDirect(glib.BaseObject(object), property, glib.NewValue(value))
}
// Code generated by girgen. DO NOT EDIT.
package adw
// #include <stdlib.h>
// #include <adwaita.h>
import "C"
// BreakpointClass: instance of this type is always passed by reference.
type BreakpointClass struct {
*breakpointClass
}
// breakpointClass is the struct that's finalized.
type breakpointClass struct {
native *C.AdwBreakpointClass
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
)
// #include <stdlib.h>
// #include <adwaita.h>
import "C"
//export _gotk4_adw1_Breakpoint_ConnectApply
func _gotk4_adw1_Breakpoint_ConnectApply(arg0 C.gpointer, arg1 C.guintptr) {
var f func()
{
closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1))
if closure == nil {
panic("given unknown closure user_data")
}
defer closure.TryRepanic()
f = closure.Func.(func())
}
f()
}
//export _gotk4_adw1_Breakpoint_ConnectUnapply
func _gotk4_adw1_Breakpoint_ConnectUnapply(arg0 C.gpointer, arg1 C.guintptr) {
var f func()
{
closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1))
if closure == nil {
panic("given unknown closure user_data")
}
defer closure.TryRepanic()
f = closure.Func.(func())
}
f()
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"runtime"
"unsafe"
"github.com/diamondburned/gotk4/pkg/core/gextras"
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
"github.com/diamondburned/gotk4/pkg/gtk/v4"
)
// #include <stdlib.h>
// #include <adwaita.h>
// #include <glib-object.h>
import "C"
// GType values.
var (
GTypeButtonContent = coreglib.Type(C.adw_button_content_get_type())
)
func init() {
coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{
coreglib.TypeMarshaler{T: GTypeButtonContent, F: marshalButtonContent},
})
}
// ButtonContentOverrides contains methods that are overridable.
type ButtonContentOverrides struct {
}
func defaultButtonContentOverrides(v *ButtonContent) ButtonContentOverrides {
return ButtonContentOverrides{}
}
// ButtonContent: helper widget for creating buttons.
//
// <picture> <source srcset="button-content-dark.png"
// media="(prefers-color-scheme: dark)"> <img src="button-content.png"
// alt="button-content"> </picture>
//
// AdwButtonContent is a box-like widget with an icon and a label.
//
// It's intended to be used as a direct child of gtk.Button, gtk.MenuButton or
// splitbutton, when they need to have both an icon and a label, as follows:
//
// <object class="GtkButton">
// <property name="child">
// <object class="AdwButtonContent">
// <property name="icon-name">document-open-symbolic</property>
// <property name="label" translatable="yes">_Open</property>
// <property name="use-underline">True</property>
// </object>
// </property>
// </object>
//
// AdwButtonContent handles style classes and connecting the mnemonic to the
// button automatically.
//
// CSS nodes
//
// buttoncontent
// ╰── box
// ├── image
// ╰── label
//
// AdwButtonContent's CSS node is called buttoncontent. It contains a box
// subnode that serves as a container for the image and label nodes.
//
// When inside a GtkButton or AdwSplitButton, the button will receive the
// .image-text-button style class. When inside a GtkMenuButton, the internal
// GtkButton will receive it instead.
//
// # Accessibility
//
// AdwButtonContent uses the GTK_ACCESSIBLE_ROLE_GROUP role.
type ButtonContent struct {
_ [0]func() // equal guard
gtk.Widget
}
var (
_ gtk.Widgetter = (*ButtonContent)(nil)
)
func init() {
coreglib.RegisterClassInfo[*ButtonContent, *ButtonContentClass, ButtonContentOverrides](
GTypeButtonContent,
initButtonContentClass,
wrapButtonContent,
defaultButtonContentOverrides,
)
}
func initButtonContentClass(gclass unsafe.Pointer, overrides ButtonContentOverrides, classInitFunc func(*ButtonContentClass)) {
if classInitFunc != nil {
class := (*ButtonContentClass)(gextras.NewStructNative(gclass))
classInitFunc(class)
}
}
func wrapButtonContent(obj *coreglib.Object) *ButtonContent {
return &ButtonContent{
Widget: gtk.Widget{
InitiallyUnowned: coreglib.InitiallyUnowned{
Object: obj,
},
Object: obj,
Accessible: gtk.Accessible{
Object: obj,
},
Buildable: gtk.Buildable{
Object: obj,
},
ConstraintTarget: gtk.ConstraintTarget{
Object: obj,
},
},
}
}
func marshalButtonContent(p uintptr) (interface{}, error) {
return wrapButtonContent(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil
}
// NewButtonContent creates a new AdwButtonContent.
//
// The function returns the following values:
//
// - buttonContent: new created AdwButtonContent.
func NewButtonContent() *ButtonContent {
var _cret *C.GtkWidget // in
_cret = C.adw_button_content_new()
var _buttonContent *ButtonContent // out
_buttonContent = wrapButtonContent(coreglib.Take(unsafe.Pointer(_cret)))
return _buttonContent
}
// CanShrink gets whether the button can be smaller than the natural size of its
// contents.
//
// The function returns the following values:
//
// - ok: whether the button can shrink.
func (self *ButtonContent) CanShrink() bool {
var _arg0 *C.AdwButtonContent // out
var _cret C.gboolean // in
_arg0 = (*C.AdwButtonContent)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_cret = C.adw_button_content_get_can_shrink(_arg0)
runtime.KeepAlive(self)
var _ok bool // out
if _cret != 0 {
_ok = true
}
return _ok
}
// IconName gets the name of the displayed icon.
//
// The function returns the following values:
//
// - utf8: icon name.
func (self *ButtonContent) IconName() string {
var _arg0 *C.AdwButtonContent // out
var _cret *C.char // in
_arg0 = (*C.AdwButtonContent)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_cret = C.adw_button_content_get_icon_name(_arg0)
runtime.KeepAlive(self)
var _utf8 string // out
_utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret)))
return _utf8
}
// Label gets the displayed label.
//
// The function returns the following values:
//
// - utf8: label.
func (self *ButtonContent) Label() string {
var _arg0 *C.AdwButtonContent // out
var _cret *C.char // in
_arg0 = (*C.AdwButtonContent)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_cret = C.adw_button_content_get_label(_arg0)
runtime.KeepAlive(self)
var _utf8 string // out
_utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret)))
return _utf8
}
// UseUnderline gets whether an underline in the text indicates a mnemonic.
//
// The function returns the following values:
//
// - ok: whether an underline in the text indicates a mnemonic.
func (self *ButtonContent) UseUnderline() bool {
var _arg0 *C.AdwButtonContent // out
var _cret C.gboolean // in
_arg0 = (*C.AdwButtonContent)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_cret = C.adw_button_content_get_use_underline(_arg0)
runtime.KeepAlive(self)
var _ok bool // out
if _cret != 0 {
_ok = true
}
return _ok
}
// SetCanShrink sets whether the button can be smaller than the natural size of
// its contents.
//
// If set to TRUE, the label will ellipsize.
//
// See gtk.Button.SetCanShrink().
//
// The function takes the following parameters:
//
// - canShrink: whether the button can shrink.
func (self *ButtonContent) SetCanShrink(canShrink bool) {
var _arg0 *C.AdwButtonContent // out
var _arg1 C.gboolean // out
_arg0 = (*C.AdwButtonContent)(unsafe.Pointer(coreglib.InternObject(self).Native()))
if canShrink {
_arg1 = C.TRUE
}
C.adw_button_content_set_can_shrink(_arg0, _arg1)
runtime.KeepAlive(self)
runtime.KeepAlive(canShrink)
}
// SetIconName sets the name of the displayed icon.
//
// If empty, the icon is not shown.
//
// The function takes the following parameters:
//
// - iconName: new icon name.
func (self *ButtonContent) SetIconName(iconName string) {
var _arg0 *C.AdwButtonContent // out
var _arg1 *C.char // out
_arg0 = (*C.AdwButtonContent)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_arg1 = (*C.char)(unsafe.Pointer(C.CString(iconName)))
defer C.free(unsafe.Pointer(_arg1))
C.adw_button_content_set_icon_name(_arg0, _arg1)
runtime.KeepAlive(self)
runtime.KeepAlive(iconName)
}
// SetLabel sets the displayed label.
//
// The function takes the following parameters:
//
// - label: new label.
func (self *ButtonContent) SetLabel(label string) {
var _arg0 *C.AdwButtonContent // out
var _arg1 *C.char // out
_arg0 = (*C.AdwButtonContent)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_arg1 = (*C.char)(unsafe.Pointer(C.CString(label)))
defer C.free(unsafe.Pointer(_arg1))
C.adw_button_content_set_label(_arg0, _arg1)
runtime.KeepAlive(self)
runtime.KeepAlive(label)
}
// SetUseUnderline sets whether an underline in the text indicates a mnemonic.
//
// The mnemonic can be used to activate the parent button.
//
// See buttoncontent:label.
//
// The function takes the following parameters:
//
// - useUnderline: whether an underline in the text indicates a mnemonic.
func (self *ButtonContent) SetUseUnderline(useUnderline bool) {
var _arg0 *C.AdwButtonContent // out
var _arg1 C.gboolean // out
_arg0 = (*C.AdwButtonContent)(unsafe.Pointer(coreglib.InternObject(self).Native()))
if useUnderline {
_arg1 = C.TRUE
}
C.adw_button_content_set_use_underline(_arg0, _arg1)
runtime.KeepAlive(self)
runtime.KeepAlive(useUnderline)
}
// ButtonContentClass: instance of this type is always passed by reference.
type ButtonContentClass struct {
*buttonContentClass
}
// buttonContentClass is the struct that's finalized.
type buttonContentClass struct {
native *C.AdwButtonContentClass
}
func (b *ButtonContentClass) ParentClass() *gtk.WidgetClass {
valptr := &b.native.parent_class
var _v *gtk.WidgetClass // out
_v = (*gtk.WidgetClass)(gextras.NewStructNative(unsafe.Pointer(valptr)))
return _v
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"unsafe"
"github.com/diamondburned/gotk4/pkg/core/gextras"
)
// #include <stdlib.h>
// #include <adwaita.h>
import "C"
// ButtonRowClass: instance of this type is always passed by reference.
type ButtonRowClass struct {
*buttonRowClass
}
// buttonRowClass is the struct that's finalized.
type buttonRowClass struct {
native *C.AdwButtonRowClass
}
func (b *ButtonRowClass) ParentClass() *PreferencesRowClass {
valptr := &b.native.parent_class
var _v *PreferencesRowClass // out
_v = (*PreferencesRowClass)(gextras.NewStructNative(unsafe.Pointer(valptr)))
return _v
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"runtime"
"unsafe"
"github.com/diamondburned/gotk4/pkg/core/gextras"
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
"github.com/diamondburned/gotk4/pkg/gtk/v4"
)
// #include <stdlib.h>
// #include <adwaita.h>
// #include <glib-object.h>
// extern void _gotk4_adw1_ButtonRow_ConnectActivated(gpointer, guintptr);
import "C"
// GType values.
var (
GTypeButtonRow = coreglib.Type(C.adw_button_row_get_type())
)
func init() {
coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{
coreglib.TypeMarshaler{T: GTypeButtonRow, F: marshalButtonRow},
})
}
// ButtonRowOverrides contains methods that are overridable.
type ButtonRowOverrides struct {
}
func defaultButtonRowOverrides(v *ButtonRow) ButtonRowOverrides {
return ButtonRowOverrides{}
}
// ButtonRow: gtk.ListBoxRow that looks like a button.
//
// <picture> <source srcset="button-rows-dark.png" media="(prefers-color-scheme:
// dark)"> <img src="button-rows.png" alt="button-rows"> </picture>
//
// The AdwButtonRow widget has a title and two icons: before and after the
// title.
//
// It is convenient for presenting actions like "Delete" at the end of a boxed
// list.
//
// AdwButtonRow is always activatable.
//
// # CSS nodes
//
// AdwButtonRow has a main CSS node with name row and the style class .button.
//
// It contains the subnode box for its main horizontal box, which contains
// the nodes: image.icon.start for the start icon, label.title for the title,
// and image.icon.end for the end icon.
//
// # Style classes
//
// The .suggested-action (style-classes.html#suggested-action) style class makes
// AdwButtonRow use accent color for its background. It should be used very
// sparingly to denote important buttons.
//
// <picture> <source srcset="button-row-suggested-action-dark.png"
// media="(prefers-color-scheme: dark)"> <img
// src="button-row-suggested-action.png" alt="button-row-suggested-action">
// </picture>
//
// The .destructive-action (style-classes.html#destructive-action) style makes
// the row use destructive colors. It can be used to draw attention to the
// potentially damaging consequences of using it. This style acts as a warning
// to the user.
//
// <picture> <source srcset="button-row-destructive-action-dark.png"
// media="(prefers-color-scheme: dark)"> <img
// src="button-row-destructive-action.png" alt="button-row-destructive-action">
// </picture>.
type ButtonRow struct {
_ [0]func() // equal guard
PreferencesRow
}
var (
_ gtk.Widgetter = (*ButtonRow)(nil)
_ coreglib.Objector = (*ButtonRow)(nil)
)
func init() {
coreglib.RegisterClassInfo[*ButtonRow, *ButtonRowClass, ButtonRowOverrides](
GTypeButtonRow,
initButtonRowClass,
wrapButtonRow,
defaultButtonRowOverrides,
)
}
func initButtonRowClass(gclass unsafe.Pointer, overrides ButtonRowOverrides, classInitFunc func(*ButtonRowClass)) {
if classInitFunc != nil {
class := (*ButtonRowClass)(gextras.NewStructNative(gclass))
classInitFunc(class)
}
}
func wrapButtonRow(obj *coreglib.Object) *ButtonRow {
return &ButtonRow{
PreferencesRow: PreferencesRow{
ListBoxRow: gtk.ListBoxRow{
Widget: gtk.Widget{
InitiallyUnowned: coreglib.InitiallyUnowned{
Object: obj,
},
Object: obj,
Accessible: gtk.Accessible{
Object: obj,
},
Buildable: gtk.Buildable{
Object: obj,
},
ConstraintTarget: gtk.ConstraintTarget{
Object: obj,
},
},
Object: obj,
Actionable: gtk.Actionable{
Widget: gtk.Widget{
InitiallyUnowned: coreglib.InitiallyUnowned{
Object: obj,
},
Object: obj,
Accessible: gtk.Accessible{
Object: obj,
},
Buildable: gtk.Buildable{
Object: obj,
},
ConstraintTarget: gtk.ConstraintTarget{
Object: obj,
},
},
},
},
},
}
}
func marshalButtonRow(p uintptr) (interface{}, error) {
return wrapButtonRow(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil
}
// ConnectActivated: this signal is emitted after the row has been activated.
func (self *ButtonRow) ConnectActivated(f func()) coreglib.SignalHandle {
return coreglib.ConnectGeneratedClosure(self, "activated", false, unsafe.Pointer(C._gotk4_adw1_ButtonRow_ConnectActivated), f)
}
// NewButtonRow creates a new AdwButtonRow.
//
// The function returns the following values:
//
// - buttonRow: newly created AdwButtonRow.
func NewButtonRow() *ButtonRow {
var _cret *C.GtkWidget // in
_cret = C.adw_button_row_new()
var _buttonRow *ButtonRow // out
_buttonRow = wrapButtonRow(coreglib.Take(unsafe.Pointer(_cret)))
return _buttonRow
}
// EndIconName gets the end icon name for self.
//
// The function returns the following values:
//
// - utf8 (optional): end icon name for self.
func (self *ButtonRow) EndIconName() string {
var _arg0 *C.AdwButtonRow // out
var _cret *C.char // in
_arg0 = (*C.AdwButtonRow)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_cret = C.adw_button_row_get_end_icon_name(_arg0)
runtime.KeepAlive(self)
var _utf8 string // out
if _cret != nil {
_utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret)))
}
return _utf8
}
// StartIconName gets the start icon name for self.
//
// The function returns the following values:
//
// - utf8 (optional): start icon name for self.
func (self *ButtonRow) StartIconName() string {
var _arg0 *C.AdwButtonRow // out
var _cret *C.char // in
_arg0 = (*C.AdwButtonRow)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_cret = C.adw_button_row_get_start_icon_name(_arg0)
runtime.KeepAlive(self)
var _utf8 string // out
if _cret != nil {
_utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret)))
}
return _utf8
}
// SetEndIconName sets the end icon name for self.
//
// The function takes the following parameters:
//
// - iconName (optional): end icon name.
func (self *ButtonRow) SetEndIconName(iconName string) {
var _arg0 *C.AdwButtonRow // out
var _arg1 *C.char // out
_arg0 = (*C.AdwButtonRow)(unsafe.Pointer(coreglib.InternObject(self).Native()))
if iconName != "" {
_arg1 = (*C.char)(unsafe.Pointer(C.CString(iconName)))
defer C.free(unsafe.Pointer(_arg1))
}
C.adw_button_row_set_end_icon_name(_arg0, _arg1)
runtime.KeepAlive(self)
runtime.KeepAlive(iconName)
}
// SetStartIconName sets the start icon name for self.
//
// The function takes the following parameters:
//
// - iconName (optional): start icon name.
func (self *ButtonRow) SetStartIconName(iconName string) {
var _arg0 *C.AdwButtonRow // out
var _arg1 *C.char // out
_arg0 = (*C.AdwButtonRow)(unsafe.Pointer(coreglib.InternObject(self).Native()))
if iconName != "" {
_arg1 = (*C.char)(unsafe.Pointer(C.CString(iconName)))
defer C.free(unsafe.Pointer(_arg1))
}
C.adw_button_row_set_start_icon_name(_arg0, _arg1)
runtime.KeepAlive(self)
runtime.KeepAlive(iconName)
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
)
// #include <stdlib.h>
// #include <adwaita.h>
import "C"
//export _gotk4_adw1_ButtonRow_ConnectActivated
func _gotk4_adw1_ButtonRow_ConnectActivated(arg0 C.gpointer, arg1 C.guintptr) {
var f func()
{
closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1))
if closure == nil {
panic("given unknown closure user_data")
}
defer closure.TryRepanic()
f = closure.Func.(func())
}
f()
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"runtime"
"unsafe"
"github.com/diamondburned/gotk4/pkg/core/gextras"
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
"github.com/diamondburned/gotk4/pkg/gtk/v4"
)
// #include <stdlib.h>
// #include <adwaita.h>
// #include <glib-object.h>
import "C"
// GType values.
var (
GTypeCarouselIndicatorDots = coreglib.Type(C.adw_carousel_indicator_dots_get_type())
)
func init() {
coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{
coreglib.TypeMarshaler{T: GTypeCarouselIndicatorDots, F: marshalCarouselIndicatorDots},
})
}
// CarouselIndicatorDotsOverrides contains methods that are overridable.
type CarouselIndicatorDotsOverrides struct {
}
func defaultCarouselIndicatorDotsOverrides(v *CarouselIndicatorDots) CarouselIndicatorDotsOverrides {
return CarouselIndicatorDotsOverrides{}
}
// CarouselIndicatorDots dots indicator for carousel.
//
// <picture> <source srcset="carousel-indicator-dots-dark.png"
// media="(prefers-color-scheme: dark)"> <img src="carousel-indicator-dots.png"
// alt="carousel-indicator-dots"> </picture>
//
// The AdwCarouselIndicatorDots widget shows a set of dots for each page of a
// given carousel. The dot representing the carousel's active page is larger and
// more opaque than the others, the transition to the active and inactive state
// is gradual to match the carousel's position.
//
// See also carouselindicatorlines.
//
// # CSS nodes
//
// AdwCarouselIndicatorDots has a single CSS node with name
// carouselindicatordots.
type CarouselIndicatorDots struct {
_ [0]func() // equal guard
gtk.Widget
*coreglib.Object
gtk.Orientable
}
var (
_ gtk.Widgetter = (*CarouselIndicatorDots)(nil)
_ coreglib.Objector = (*CarouselIndicatorDots)(nil)
)
func init() {
coreglib.RegisterClassInfo[*CarouselIndicatorDots, *CarouselIndicatorDotsClass, CarouselIndicatorDotsOverrides](
GTypeCarouselIndicatorDots,
initCarouselIndicatorDotsClass,
wrapCarouselIndicatorDots,
defaultCarouselIndicatorDotsOverrides,
)
}
func initCarouselIndicatorDotsClass(gclass unsafe.Pointer, overrides CarouselIndicatorDotsOverrides, classInitFunc func(*CarouselIndicatorDotsClass)) {
if classInitFunc != nil {
class := (*CarouselIndicatorDotsClass)(gextras.NewStructNative(gclass))
classInitFunc(class)
}
}
func wrapCarouselIndicatorDots(obj *coreglib.Object) *CarouselIndicatorDots {
return &CarouselIndicatorDots{
Widget: gtk.Widget{
InitiallyUnowned: coreglib.InitiallyUnowned{
Object: obj,
},
Object: obj,
Accessible: gtk.Accessible{
Object: obj,
},
Buildable: gtk.Buildable{
Object: obj,
},
ConstraintTarget: gtk.ConstraintTarget{
Object: obj,
},
},
Object: obj,
Orientable: gtk.Orientable{
Object: obj,
},
}
}
func marshalCarouselIndicatorDots(p uintptr) (interface{}, error) {
return wrapCarouselIndicatorDots(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil
}
// NewCarouselIndicatorDots creates a new AdwCarouselIndicatorDots.
//
// The function returns the following values:
//
// - carouselIndicatorDots: newly created AdwCarouselIndicatorDots.
func NewCarouselIndicatorDots() *CarouselIndicatorDots {
var _cret *C.GtkWidget // in
_cret = C.adw_carousel_indicator_dots_new()
var _carouselIndicatorDots *CarouselIndicatorDots // out
_carouselIndicatorDots = wrapCarouselIndicatorDots(coreglib.Take(unsafe.Pointer(_cret)))
return _carouselIndicatorDots
}
// Carousel gets the displayed carousel.
//
// The function returns the following values:
//
// - carousel (optional): displayed carousel.
func (self *CarouselIndicatorDots) Carousel() *Carousel {
var _arg0 *C.AdwCarouselIndicatorDots // out
var _cret *C.AdwCarousel // in
_arg0 = (*C.AdwCarouselIndicatorDots)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_cret = C.adw_carousel_indicator_dots_get_carousel(_arg0)
runtime.KeepAlive(self)
var _carousel *Carousel // out
if _cret != nil {
_carousel = wrapCarousel(coreglib.Take(unsafe.Pointer(_cret)))
}
return _carousel
}
// SetCarousel sets the displayed carousel.
//
// The function takes the following parameters:
//
// - carousel (optional): carousel.
func (self *CarouselIndicatorDots) SetCarousel(carousel *Carousel) {
var _arg0 *C.AdwCarouselIndicatorDots // out
var _arg1 *C.AdwCarousel // out
_arg0 = (*C.AdwCarouselIndicatorDots)(unsafe.Pointer(coreglib.InternObject(self).Native()))
if carousel != nil {
_arg1 = (*C.AdwCarousel)(unsafe.Pointer(coreglib.InternObject(carousel).Native()))
}
C.adw_carousel_indicator_dots_set_carousel(_arg0, _arg1)
runtime.KeepAlive(self)
runtime.KeepAlive(carousel)
}
// CarouselIndicatorDotsClass: instance of this type is always passed by
// reference.
type CarouselIndicatorDotsClass struct {
*carouselIndicatorDotsClass
}
// carouselIndicatorDotsClass is the struct that's finalized.
type carouselIndicatorDotsClass struct {
native *C.AdwCarouselIndicatorDotsClass
}
func (c *CarouselIndicatorDotsClass) ParentClass() *gtk.WidgetClass {
valptr := &c.native.parent_class
var _v *gtk.WidgetClass // out
_v = (*gtk.WidgetClass)(gextras.NewStructNative(unsafe.Pointer(valptr)))
return _v
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"runtime"
"unsafe"
"github.com/diamondburned/gotk4/pkg/core/gextras"
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
"github.com/diamondburned/gotk4/pkg/gtk/v4"
)
// #include <stdlib.h>
// #include <adwaita.h>
// #include <glib-object.h>
import "C"
// GType values.
var (
GTypeCarouselIndicatorLines = coreglib.Type(C.adw_carousel_indicator_lines_get_type())
)
func init() {
coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{
coreglib.TypeMarshaler{T: GTypeCarouselIndicatorLines, F: marshalCarouselIndicatorLines},
})
}
// CarouselIndicatorLinesOverrides contains methods that are overridable.
type CarouselIndicatorLinesOverrides struct {
}
func defaultCarouselIndicatorLinesOverrides(v *CarouselIndicatorLines) CarouselIndicatorLinesOverrides {
return CarouselIndicatorLinesOverrides{}
}
// CarouselIndicatorLines lines indicator for carousel.
//
// <picture> <source srcset="carousel-indicator-dots-lines.png"
// media="(prefers-color-scheme: dark)"> <img src="carousel-indicator-lines.png"
// alt="carousel-indicator-lines"> </picture>
//
// The AdwCarouselIndicatorLines widget shows a set of lines for each page of
// a given carousel. The carousel's active page is shown as another line that
// moves between them to match the carousel's position.
//
// See also carouselindicatordots.
//
// # CSS nodes
//
// AdwCarouselIndicatorLines has a single CSS node with name
// carouselindicatorlines.
type CarouselIndicatorLines struct {
_ [0]func() // equal guard
gtk.Widget
*coreglib.Object
gtk.Orientable
}
var (
_ gtk.Widgetter = (*CarouselIndicatorLines)(nil)
_ coreglib.Objector = (*CarouselIndicatorLines)(nil)
)
func init() {
coreglib.RegisterClassInfo[*CarouselIndicatorLines, *CarouselIndicatorLinesClass, CarouselIndicatorLinesOverrides](
GTypeCarouselIndicatorLines,
initCarouselIndicatorLinesClass,
wrapCarouselIndicatorLines,
defaultCarouselIndicatorLinesOverrides,
)
}
func initCarouselIndicatorLinesClass(gclass unsafe.Pointer, overrides CarouselIndicatorLinesOverrides, classInitFunc func(*CarouselIndicatorLinesClass)) {
if classInitFunc != nil {
class := (*CarouselIndicatorLinesClass)(gextras.NewStructNative(gclass))
classInitFunc(class)
}
}
func wrapCarouselIndicatorLines(obj *coreglib.Object) *CarouselIndicatorLines {
return &CarouselIndicatorLines{
Widget: gtk.Widget{
InitiallyUnowned: coreglib.InitiallyUnowned{
Object: obj,
},
Object: obj,
Accessible: gtk.Accessible{
Object: obj,
},
Buildable: gtk.Buildable{
Object: obj,
},
ConstraintTarget: gtk.ConstraintTarget{
Object: obj,
},
},
Object: obj,
Orientable: gtk.Orientable{
Object: obj,
},
}
}
func marshalCarouselIndicatorLines(p uintptr) (interface{}, error) {
return wrapCarouselIndicatorLines(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil
}
// NewCarouselIndicatorLines creates a new AdwCarouselIndicatorLines.
//
// The function returns the following values:
//
// - carouselIndicatorLines: newly created AdwCarouselIndicatorLines.
func NewCarouselIndicatorLines() *CarouselIndicatorLines {
var _cret *C.GtkWidget // in
_cret = C.adw_carousel_indicator_lines_new()
var _carouselIndicatorLines *CarouselIndicatorLines // out
_carouselIndicatorLines = wrapCarouselIndicatorLines(coreglib.Take(unsafe.Pointer(_cret)))
return _carouselIndicatorLines
}
// Carousel gets the displayed carousel.
//
// The function returns the following values:
//
// - carousel (optional): displayed carousel.
func (self *CarouselIndicatorLines) Carousel() *Carousel {
var _arg0 *C.AdwCarouselIndicatorLines // out
var _cret *C.AdwCarousel // in
_arg0 = (*C.AdwCarouselIndicatorLines)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_cret = C.adw_carousel_indicator_lines_get_carousel(_arg0)
runtime.KeepAlive(self)
var _carousel *Carousel // out
if _cret != nil {
_carousel = wrapCarousel(coreglib.Take(unsafe.Pointer(_cret)))
}
return _carousel
}
// SetCarousel sets the displayed carousel.
//
// The function takes the following parameters:
//
// - carousel (optional): carousel.
func (self *CarouselIndicatorLines) SetCarousel(carousel *Carousel) {
var _arg0 *C.AdwCarouselIndicatorLines // out
var _arg1 *C.AdwCarousel // out
_arg0 = (*C.AdwCarouselIndicatorLines)(unsafe.Pointer(coreglib.InternObject(self).Native()))
if carousel != nil {
_arg1 = (*C.AdwCarousel)(unsafe.Pointer(coreglib.InternObject(carousel).Native()))
}
C.adw_carousel_indicator_lines_set_carousel(_arg0, _arg1)
runtime.KeepAlive(self)
runtime.KeepAlive(carousel)
}
// CarouselIndicatorLinesClass: instance of this type is always passed by
// reference.
type CarouselIndicatorLinesClass struct {
*carouselIndicatorLinesClass
}
// carouselIndicatorLinesClass is the struct that's finalized.
type carouselIndicatorLinesClass struct {
native *C.AdwCarouselIndicatorLinesClass
}
func (c *CarouselIndicatorLinesClass) ParentClass() *gtk.WidgetClass {
valptr := &c.native.parent_class
var _v *gtk.WidgetClass // out
_v = (*gtk.WidgetClass)(gextras.NewStructNative(unsafe.Pointer(valptr)))
return _v
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
)
// #include <stdlib.h>
// #include <adwaita.h>
import "C"
//export _gotk4_adw1_Carousel_ConnectPageChanged
func _gotk4_adw1_Carousel_ConnectPageChanged(arg0 C.gpointer, arg1 C.guint, arg2 C.guintptr) {
var f func(index uint)
{
closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2))
if closure == nil {
panic("given unknown closure user_data")
}
defer closure.TryRepanic()
f = closure.Func.(func(index uint))
}
var _index uint // out
_index = uint(arg1)
f(_index)
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"runtime"
"unsafe"
"github.com/diamondburned/gotk4/pkg/core/gextras"
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
"github.com/diamondburned/gotk4/pkg/gtk/v4"
)
// #include <stdlib.h>
// #include <adwaita.h>
// #include <glib-object.h>
import "C"
// GType values.
var (
GTypeClampLayout = coreglib.Type(C.adw_clamp_layout_get_type())
)
func init() {
coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{
coreglib.TypeMarshaler{T: GTypeClampLayout, F: marshalClampLayout},
})
}
// ClampLayoutOverrides contains methods that are overridable.
type ClampLayoutOverrides struct {
}
func defaultClampLayoutOverrides(v *ClampLayout) ClampLayoutOverrides {
return ClampLayoutOverrides{}
}
// ClampLayout: layout manager constraining its children to a given size.
//
// <picture> <source srcset="clamp-wide-dark.png" media="(prefers-color-scheme:
// dark)"> <img src="clamp-wide.png" alt="clamp-wide"> </picture> <picture>
// <source srcset="clamp-narrow-dark.png" media="(prefers-color-scheme: dark)">
// <img src="clamp-narrow.png" alt="clamp-narrow"> </picture>
//
// AdwClampLayout constraints the size of the widgets it contains to a given
// maximum size. It will constrain the width if it is horizontal, or the height
// if it is vertical. The expansion of the children from their minimum to their
// maximum size is eased out for a smooth transition.
//
// If a child requires more than the requested maximum size, it will be
// allocated the minimum size it can fit in instead.
//
// AdwClampLayout can scale with the text scale factor, use the clamplayout:unit
// property to enable that behavior.
//
// See also: clamp, clampscrollable.
type ClampLayout struct {
_ [0]func() // equal guard
gtk.LayoutManager
*coreglib.Object
gtk.Orientable
}
var (
_ gtk.LayoutManagerer = (*ClampLayout)(nil)
_ coreglib.Objector = (*ClampLayout)(nil)
)
func init() {
coreglib.RegisterClassInfo[*ClampLayout, *ClampLayoutClass, ClampLayoutOverrides](
GTypeClampLayout,
initClampLayoutClass,
wrapClampLayout,
defaultClampLayoutOverrides,
)
}
func initClampLayoutClass(gclass unsafe.Pointer, overrides ClampLayoutOverrides, classInitFunc func(*ClampLayoutClass)) {
if classInitFunc != nil {
class := (*ClampLayoutClass)(gextras.NewStructNative(gclass))
classInitFunc(class)
}
}
func wrapClampLayout(obj *coreglib.Object) *ClampLayout {
return &ClampLayout{
LayoutManager: gtk.LayoutManager{
Object: obj,
},
Object: obj,
Orientable: gtk.Orientable{
Object: obj,
},
}
}
func marshalClampLayout(p uintptr) (interface{}, error) {
return wrapClampLayout(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil
}
// NewClampLayout creates a new AdwClampLayout.
//
// The function returns the following values:
//
// - clampLayout: newly created AdwClampLayout.
func NewClampLayout() *ClampLayout {
var _cret *C.GtkLayoutManager // in
_cret = C.adw_clamp_layout_new()
var _clampLayout *ClampLayout // out
_clampLayout = wrapClampLayout(coreglib.AssumeOwnership(unsafe.Pointer(_cret)))
return _clampLayout
}
// MaximumSize gets the maximum size allocated to the children.
//
// The function returns the following values:
//
// - gint: maximum size to allocate to the children.
func (self *ClampLayout) MaximumSize() int {
var _arg0 *C.AdwClampLayout // out
var _cret C.int // in
_arg0 = (*C.AdwClampLayout)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_cret = C.adw_clamp_layout_get_maximum_size(_arg0)
runtime.KeepAlive(self)
var _gint int // out
_gint = int(_cret)
return _gint
}
// TighteningThreshold gets the size above which the children are clamped.
//
// The function returns the following values:
//
// - gint: size above which the children are clamped.
func (self *ClampLayout) TighteningThreshold() int {
var _arg0 *C.AdwClampLayout // out
var _cret C.int // in
_arg0 = (*C.AdwClampLayout)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_cret = C.adw_clamp_layout_get_tightening_threshold(_arg0)
runtime.KeepAlive(self)
var _gint int // out
_gint = int(_cret)
return _gint
}
// Unit gets the length unit for maximum size and tightening threshold.
//
// The function returns the following values:
//
// - lengthUnit: length unit.
func (self *ClampLayout) Unit() LengthUnit {
var _arg0 *C.AdwClampLayout // out
var _cret C.AdwLengthUnit // in
_arg0 = (*C.AdwClampLayout)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_cret = C.adw_clamp_layout_get_unit(_arg0)
runtime.KeepAlive(self)
var _lengthUnit LengthUnit // out
_lengthUnit = LengthUnit(_cret)
return _lengthUnit
}
// SetMaximumSize sets the maximum size allocated to the children.
//
// It is the width if the layout is horizontal, or the height if it is vertical.
//
// The function takes the following parameters:
//
// - maximumSize: maximum size.
func (self *ClampLayout) SetMaximumSize(maximumSize int) {
var _arg0 *C.AdwClampLayout // out
var _arg1 C.int // out
_arg0 = (*C.AdwClampLayout)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_arg1 = C.int(maximumSize)
C.adw_clamp_layout_set_maximum_size(_arg0, _arg1)
runtime.KeepAlive(self)
runtime.KeepAlive(maximumSize)
}
// SetTighteningThreshold sets the size above which the children are clamped.
//
// Starting from this size, the layout will tighten its grip on the children,
// slowly allocating less and less of the available size up to the maximum
// allocated size. Below that threshold and below the maximum size, the children
// will be allocated all the available size.
//
// If the threshold is greater than the maximum size to allocate to the
// children, they will be allocated the whole size up to the maximum.
// If the threshold is lower than the minimum size to allocate to the children,
// that size will be used as the tightening threshold.
//
// Effectively, tightening the grip on a child before it reaches its maximum
// size makes transitions to and from the maximum size smoother when resizing.
//
// The function takes the following parameters:
//
// - tighteningThreshold: tightening threshold.
func (self *ClampLayout) SetTighteningThreshold(tighteningThreshold int) {
var _arg0 *C.AdwClampLayout // out
var _arg1 C.int // out
_arg0 = (*C.AdwClampLayout)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_arg1 = C.int(tighteningThreshold)
C.adw_clamp_layout_set_tightening_threshold(_arg0, _arg1)
runtime.KeepAlive(self)
runtime.KeepAlive(tighteningThreshold)
}
// SetUnit sets the length unit for maximum size and tightening threshold.
//
// Allows the sizes to vary depending on the text scale factor.
//
// The function takes the following parameters:
//
// - unit: length unit.
func (self *ClampLayout) SetUnit(unit LengthUnit) {
var _arg0 *C.AdwClampLayout // out
var _arg1 C.AdwLengthUnit // out
_arg0 = (*C.AdwClampLayout)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_arg1 = C.AdwLengthUnit(unit)
C.adw_clamp_layout_set_unit(_arg0, _arg1)
runtime.KeepAlive(self)
runtime.KeepAlive(unit)
}
// ClampLayoutClass: instance of this type is always passed by reference.
type ClampLayoutClass struct {
*clampLayoutClass
}
// clampLayoutClass is the struct that's finalized.
type clampLayoutClass struct {
native *C.AdwClampLayoutClass
}
func (c *ClampLayoutClass) ParentClass() *gtk.LayoutManagerClass {
valptr := &c.native.parent_class
var _v *gtk.LayoutManagerClass // out
_v = (*gtk.LayoutManagerClass)(gextras.NewStructNative(unsafe.Pointer(valptr)))
return _v
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"runtime"
"unsafe"
"github.com/diamondburned/gotk4/pkg/core/gextras"
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
"github.com/diamondburned/gotk4/pkg/gtk/v4"
)
// #include <stdlib.h>
// #include <adwaita.h>
// #include <glib-object.h>
import "C"
// GType values.
var (
GTypeClampScrollable = coreglib.Type(C.adw_clamp_scrollable_get_type())
)
func init() {
coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{
coreglib.TypeMarshaler{T: GTypeClampScrollable, F: marshalClampScrollable},
})
}
// ClampScrollableOverrides contains methods that are overridable.
type ClampScrollableOverrides struct {
}
func defaultClampScrollableOverrides(v *ClampScrollable) ClampScrollableOverrides {
return ClampScrollableOverrides{}
}
// ClampScrollable: scrollable clamp.
//
// AdwClampScrollable is a variant of clamp that implements the gtk.Scrollable
// interface.
//
// The primary use case for AdwClampScrollable is clamping gtk.ListView.
//
// See also: clamplayout.
type ClampScrollable struct {
_ [0]func() // equal guard
gtk.Widget
*coreglib.Object
gtk.Orientable
gtk.Scrollable
}
var (
_ gtk.Widgetter = (*ClampScrollable)(nil)
_ coreglib.Objector = (*ClampScrollable)(nil)
)
func init() {
coreglib.RegisterClassInfo[*ClampScrollable, *ClampScrollableClass, ClampScrollableOverrides](
GTypeClampScrollable,
initClampScrollableClass,
wrapClampScrollable,
defaultClampScrollableOverrides,
)
}
func initClampScrollableClass(gclass unsafe.Pointer, overrides ClampScrollableOverrides, classInitFunc func(*ClampScrollableClass)) {
if classInitFunc != nil {
class := (*ClampScrollableClass)(gextras.NewStructNative(gclass))
classInitFunc(class)
}
}
func wrapClampScrollable(obj *coreglib.Object) *ClampScrollable {
return &ClampScrollable{
Widget: gtk.Widget{
InitiallyUnowned: coreglib.InitiallyUnowned{
Object: obj,
},
Object: obj,
Accessible: gtk.Accessible{
Object: obj,
},
Buildable: gtk.Buildable{
Object: obj,
},
ConstraintTarget: gtk.ConstraintTarget{
Object: obj,
},
},
Object: obj,
Orientable: gtk.Orientable{
Object: obj,
},
Scrollable: gtk.Scrollable{
Object: obj,
},
}
}
func marshalClampScrollable(p uintptr) (interface{}, error) {
return wrapClampScrollable(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil
}
// NewClampScrollable creates a new AdwClampScrollable.
//
// The function returns the following values:
//
// - clampScrollable: newly created AdwClampScrollable.
func NewClampScrollable() *ClampScrollable {
var _cret *C.GtkWidget // in
_cret = C.adw_clamp_scrollable_new()
var _clampScrollable *ClampScrollable // out
_clampScrollable = wrapClampScrollable(coreglib.Take(unsafe.Pointer(_cret)))
return _clampScrollable
}
// Child gets the child widget of self.
//
// The function returns the following values:
//
// - widget (optional): child widget of self.
func (self *ClampScrollable) Child() gtk.Widgetter {
var _arg0 *C.AdwClampScrollable // out
var _cret *C.GtkWidget // in
_arg0 = (*C.AdwClampScrollable)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_cret = C.adw_clamp_scrollable_get_child(_arg0)
runtime.KeepAlive(self)
var _widget gtk.Widgetter // out
if _cret != nil {
{
objptr := unsafe.Pointer(_cret)
object := coreglib.Take(objptr)
casted := object.WalkCast(func(obj coreglib.Objector) bool {
_, ok := obj.(gtk.Widgetter)
return ok
})
rv, ok := casted.(gtk.Widgetter)
if !ok {
panic("no marshaler for " + object.TypeFromInstance().String() + " matching gtk.Widgetter")
}
_widget = rv
}
}
return _widget
}
// MaximumSize gets the maximum size allocated to the child.
//
// The function returns the following values:
//
// - gint: maximum size to allocate to the child.
func (self *ClampScrollable) MaximumSize() int {
var _arg0 *C.AdwClampScrollable // out
var _cret C.int // in
_arg0 = (*C.AdwClampScrollable)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_cret = C.adw_clamp_scrollable_get_maximum_size(_arg0)
runtime.KeepAlive(self)
var _gint int // out
_gint = int(_cret)
return _gint
}
// TighteningThreshold gets the size above which the child is clamped.
//
// The function returns the following values:
//
// - gint: size above which the child is clamped.
func (self *ClampScrollable) TighteningThreshold() int {
var _arg0 *C.AdwClampScrollable // out
var _cret C.int // in
_arg0 = (*C.AdwClampScrollable)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_cret = C.adw_clamp_scrollable_get_tightening_threshold(_arg0)
runtime.KeepAlive(self)
var _gint int // out
_gint = int(_cret)
return _gint
}
// Unit gets the length unit for maximum size and tightening threshold.
//
// The function returns the following values:
//
// - lengthUnit: length unit.
func (self *ClampScrollable) Unit() LengthUnit {
var _arg0 *C.AdwClampScrollable // out
var _cret C.AdwLengthUnit // in
_arg0 = (*C.AdwClampScrollable)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_cret = C.adw_clamp_scrollable_get_unit(_arg0)
runtime.KeepAlive(self)
var _lengthUnit LengthUnit // out
_lengthUnit = LengthUnit(_cret)
return _lengthUnit
}
// SetChild sets the child widget of self.
//
// The function takes the following parameters:
//
// - child (optional) widget.
func (self *ClampScrollable) SetChild(child gtk.Widgetter) {
var _arg0 *C.AdwClampScrollable // out
var _arg1 *C.GtkWidget // out
_arg0 = (*C.AdwClampScrollable)(unsafe.Pointer(coreglib.InternObject(self).Native()))
if child != nil {
_arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(child).Native()))
}
C.adw_clamp_scrollable_set_child(_arg0, _arg1)
runtime.KeepAlive(self)
runtime.KeepAlive(child)
}
// SetMaximumSize sets the maximum size allocated to the child.
//
// It is the width if the clamp is horizontal, or the height if it is vertical.
//
// The function takes the following parameters:
//
// - maximumSize: maximum size.
func (self *ClampScrollable) SetMaximumSize(maximumSize int) {
var _arg0 *C.AdwClampScrollable // out
var _arg1 C.int // out
_arg0 = (*C.AdwClampScrollable)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_arg1 = C.int(maximumSize)
C.adw_clamp_scrollable_set_maximum_size(_arg0, _arg1)
runtime.KeepAlive(self)
runtime.KeepAlive(maximumSize)
}
// SetTighteningThreshold sets the size above which the child is clamped.
//
// Starting from this size, the clamp will tighten its grip on the child, slowly
// allocating less and less of the available size up to the maximum allocated
// size. Below that threshold and below the maximum width, the child will be
// allocated all the available size.
//
// If the threshold is greater than the maximum size to allocate to the child,
// the child will be allocated all the width up to the maximum. If the threshold
// is lower than the minimum size to allocate to the child, that size will be
// used as the tightening threshold.
//
// Effectively, tightening the grip on the child before it reaches its maximum
// size makes transitions to and from the maximum size smoother when resizing.
//
// The function takes the following parameters:
//
// - tighteningThreshold: tightening threshold.
func (self *ClampScrollable) SetTighteningThreshold(tighteningThreshold int) {
var _arg0 *C.AdwClampScrollable // out
var _arg1 C.int // out
_arg0 = (*C.AdwClampScrollable)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_arg1 = C.int(tighteningThreshold)
C.adw_clamp_scrollable_set_tightening_threshold(_arg0, _arg1)
runtime.KeepAlive(self)
runtime.KeepAlive(tighteningThreshold)
}
// SetUnit sets the length unit for maximum size and tightening threshold.
//
// Allows the sizes to vary depending on the text scale factor.
//
// The function takes the following parameters:
//
// - unit: length unit.
func (self *ClampScrollable) SetUnit(unit LengthUnit) {
var _arg0 *C.AdwClampScrollable // out
var _arg1 C.AdwLengthUnit // out
_arg0 = (*C.AdwClampScrollable)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_arg1 = C.AdwLengthUnit(unit)
C.adw_clamp_scrollable_set_unit(_arg0, _arg1)
runtime.KeepAlive(self)
runtime.KeepAlive(unit)
}
// ClampScrollableClass: instance of this type is always passed by reference.
type ClampScrollableClass struct {
*clampScrollableClass
}
// clampScrollableClass is the struct that's finalized.
type clampScrollableClass struct {
native *C.AdwClampScrollableClass
}
func (c *ClampScrollableClass) ParentClass() *gtk.WidgetClass {
valptr := &c.native.parent_class
var _v *gtk.WidgetClass // out
_v = (*gtk.WidgetClass)(gextras.NewStructNative(unsafe.Pointer(valptr)))
return _v
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"runtime"
"unsafe"
"github.com/diamondburned/gotk4/pkg/core/gextras"
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
"github.com/diamondburned/gotk4/pkg/gtk/v4"
)
// #include <stdlib.h>
// #include <adwaita.h>
// #include <glib-object.h>
import "C"
// GType values.
var (
GTypeClamp = coreglib.Type(C.adw_clamp_get_type())
)
func init() {
coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{
coreglib.TypeMarshaler{T: GTypeClamp, F: marshalClamp},
})
}
// ClampOverrides contains methods that are overridable.
type ClampOverrides struct {
}
func defaultClampOverrides(v *Clamp) ClampOverrides {
return ClampOverrides{}
}
// Clamp: widget constraining its child to a given size.
//
// <picture> <source srcset="clamp-wide-dark.png" media="(prefers-color-scheme:
// dark)"> <img src="clamp-wide.png" alt="clamp-wide"> </picture> <picture>
// <source srcset="clamp-narrow-dark.png" media="(prefers-color-scheme: dark)">
// <img src="clamp-narrow.png" alt="clamp-narrow"> </picture>
//
// The AdwClamp widget constrains the size of the widget it contains to a given
// maximum size. It will constrain the width if it is horizontal, or the height
// if it is vertical. The expansion of the child from its minimum to its maximum
// size is eased out for a smooth transition.
//
// If the child requires more than the requested maximum size, it will be
// allocated the minimum size it can fit in instead.
//
// AdwClamp can scale with the text scale factor, use the clamp:unit property to
// enable that behavior.
//
// See also: clamplayout, clampscrollable.
//
// # CSS nodes
//
// AdwClamp has a single CSS node with name clamp.
type Clamp struct {
_ [0]func() // equal guard
gtk.Widget
*coreglib.Object
gtk.Orientable
}
var (
_ gtk.Widgetter = (*Clamp)(nil)
_ coreglib.Objector = (*Clamp)(nil)
)
func init() {
coreglib.RegisterClassInfo[*Clamp, *ClampClass, ClampOverrides](
GTypeClamp,
initClampClass,
wrapClamp,
defaultClampOverrides,
)
}
func initClampClass(gclass unsafe.Pointer, overrides ClampOverrides, classInitFunc func(*ClampClass)) {
if classInitFunc != nil {
class := (*ClampClass)(gextras.NewStructNative(gclass))
classInitFunc(class)
}
}
func wrapClamp(obj *coreglib.Object) *Clamp {
return &Clamp{
Widget: gtk.Widget{
InitiallyUnowned: coreglib.InitiallyUnowned{
Object: obj,
},
Object: obj,
Accessible: gtk.Accessible{
Object: obj,
},
Buildable: gtk.Buildable{
Object: obj,
},
ConstraintTarget: gtk.ConstraintTarget{
Object: obj,
},
},
Object: obj,
Orientable: gtk.Orientable{
Object: obj,
},
}
}
func marshalClamp(p uintptr) (interface{}, error) {
return wrapClamp(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil
}
// NewClamp creates a new AdwClamp.
//
// The function returns the following values:
//
// - clamp: newly created AdwClamp.
func NewClamp() *Clamp {
var _cret *C.GtkWidget // in
_cret = C.adw_clamp_new()
var _clamp *Clamp // out
_clamp = wrapClamp(coreglib.Take(unsafe.Pointer(_cret)))
return _clamp
}
// Child gets the child widget of self.
//
// The function returns the following values:
//
// - widget (optional): child widget of self.
func (self *Clamp) Child() gtk.Widgetter {
var _arg0 *C.AdwClamp // out
var _cret *C.GtkWidget // in
_arg0 = (*C.AdwClamp)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_cret = C.adw_clamp_get_child(_arg0)
runtime.KeepAlive(self)
var _widget gtk.Widgetter // out
if _cret != nil {
{
objptr := unsafe.Pointer(_cret)
object := coreglib.Take(objptr)
casted := object.WalkCast(func(obj coreglib.Objector) bool {
_, ok := obj.(gtk.Widgetter)
return ok
})
rv, ok := casted.(gtk.Widgetter)
if !ok {
panic("no marshaler for " + object.TypeFromInstance().String() + " matching gtk.Widgetter")
}
_widget = rv
}
}
return _widget
}
// MaximumSize gets the maximum size allocated to the child.
//
// The function returns the following values:
//
// - gint: maximum size to allocate to the child.
func (self *Clamp) MaximumSize() int {
var _arg0 *C.AdwClamp // out
var _cret C.int // in
_arg0 = (*C.AdwClamp)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_cret = C.adw_clamp_get_maximum_size(_arg0)
runtime.KeepAlive(self)
var _gint int // out
_gint = int(_cret)
return _gint
}
// TighteningThreshold gets the size above which the child is clamped.
//
// The function returns the following values:
//
// - gint: size above which the child is clamped.
func (self *Clamp) TighteningThreshold() int {
var _arg0 *C.AdwClamp // out
var _cret C.int // in
_arg0 = (*C.AdwClamp)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_cret = C.adw_clamp_get_tightening_threshold(_arg0)
runtime.KeepAlive(self)
var _gint int // out
_gint = int(_cret)
return _gint
}
// Unit gets the length unit for maximum size and tightening threshold.
//
// The function returns the following values:
//
// - lengthUnit: length unit.
func (self *Clamp) Unit() LengthUnit {
var _arg0 *C.AdwClamp // out
var _cret C.AdwLengthUnit // in
_arg0 = (*C.AdwClamp)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_cret = C.adw_clamp_get_unit(_arg0)
runtime.KeepAlive(self)
var _lengthUnit LengthUnit // out
_lengthUnit = LengthUnit(_cret)
return _lengthUnit
}
// SetChild sets the child widget of self.
//
// The function takes the following parameters:
//
// - child (optional) widget.
func (self *Clamp) SetChild(child gtk.Widgetter) {
var _arg0 *C.AdwClamp // out
var _arg1 *C.GtkWidget // out
_arg0 = (*C.AdwClamp)(unsafe.Pointer(coreglib.InternObject(self).Native()))
if child != nil {
_arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(child).Native()))
}
C.adw_clamp_set_child(_arg0, _arg1)
runtime.KeepAlive(self)
runtime.KeepAlive(child)
}
// SetMaximumSize sets the maximum size allocated to the child.
//
// It is the width if the clamp is horizontal, or the height if it is vertical.
//
// The function takes the following parameters:
//
// - maximumSize: maximum size.
func (self *Clamp) SetMaximumSize(maximumSize int) {
var _arg0 *C.AdwClamp // out
var _arg1 C.int // out
_arg0 = (*C.AdwClamp)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_arg1 = C.int(maximumSize)
C.adw_clamp_set_maximum_size(_arg0, _arg1)
runtime.KeepAlive(self)
runtime.KeepAlive(maximumSize)
}
// SetTighteningThreshold sets the size above which the child is clamped.
//
// Starting from this size, the clamp will tighten its grip on the child,
// slowly allocating less and less of the available size up to the maximum
// allocated size. Below that threshold and below the maximum size, the child
// will be allocated all the available size.
//
// If the threshold is greater than the maximum size to allocate to the child,
// the child will be allocated all the size up to the maximum. If the threshold
// is lower than the minimum size to allocate to the child, that size will be
// used as the tightening threshold.
//
// Effectively, tightening the grip on the child before it reaches its maximum
// size makes transitions to and from the maximum size smoother when resizing.
//
// The function takes the following parameters:
//
// - tighteningThreshold: tightening threshold.
func (self *Clamp) SetTighteningThreshold(tighteningThreshold int) {
var _arg0 *C.AdwClamp // out
var _arg1 C.int // out
_arg0 = (*C.AdwClamp)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_arg1 = C.int(tighteningThreshold)
C.adw_clamp_set_tightening_threshold(_arg0, _arg1)
runtime.KeepAlive(self)
runtime.KeepAlive(tighteningThreshold)
}
// SetUnit sets the length unit for maximum size and tightening threshold.
//
// Allows the sizes to vary depending on the text scale factor.
//
// The function takes the following parameters:
//
// - unit: length unit.
func (self *Clamp) SetUnit(unit LengthUnit) {
var _arg0 *C.AdwClamp // out
var _arg1 C.AdwLengthUnit // out
_arg0 = (*C.AdwClamp)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_arg1 = C.AdwLengthUnit(unit)
C.adw_clamp_set_unit(_arg0, _arg1)
runtime.KeepAlive(self)
runtime.KeepAlive(unit)
}
// ClampClass: instance of this type is always passed by reference.
type ClampClass struct {
*clampClass
}
// clampClass is the struct that's finalized.
type clampClass struct {
native *C.AdwClampClass
}
func (c *ClampClass) ParentClass() *gtk.WidgetClass {
valptr := &c.native.parent_class
var _v *gtk.WidgetClass // out
_v = (*gtk.WidgetClass)(gextras.NewStructNative(unsafe.Pointer(valptr)))
return _v
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"unsafe"
"github.com/diamondburned/gotk4/pkg/core/gextras"
"github.com/diamondburned/gotk4/pkg/gtk/v4"
)
// #include <stdlib.h>
// #include <adwaita.h>
import "C"
// DialogClass: instance of this type is always passed by reference.
type DialogClass struct {
*dialogClass
}
// dialogClass is the struct that's finalized.
type dialogClass struct {
native *C.AdwDialogClass
}
func (d *DialogClass) ParentClass() *gtk.WidgetClass {
valptr := &d.native.parent_class
var _v *gtk.WidgetClass // out
_v = (*gtk.WidgetClass)(gextras.NewStructNative(unsafe.Pointer(valptr)))
return _v
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
)
// #include <stdlib.h>
// #include <adwaita.h>
import "C"
//export _gotk4_adw1_Dialog_ConnectCloseAttempt
func _gotk4_adw1_Dialog_ConnectCloseAttempt(arg0 C.gpointer, arg1 C.guintptr) {
var f func()
{
closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1))
if closure == nil {
panic("given unknown closure user_data")
}
defer closure.TryRepanic()
f = closure.Func.(func())
}
f()
}
//export _gotk4_adw1_Dialog_ConnectClosed
func _gotk4_adw1_Dialog_ConnectClosed(arg0 C.gpointer, arg1 C.guintptr) {
var f func()
{
closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1))
if closure == nil {
panic("given unknown closure user_data")
}
defer closure.TryRepanic()
f = closure.Func.(func())
}
f()
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"fmt"
"runtime"
"unsafe"
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
)
// #include <stdlib.h>
// #include <adwaita.h>
// #include <glib-object.h>
import "C"
// GType values.
var (
GTypeEasing = coreglib.Type(C.adw_easing_get_type())
)
func init() {
coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{
coreglib.TypeMarshaler{T: GTypeEasing, F: marshalEasing},
})
}
// Easing describes the available easing functions for use with timedanimation.
//
// New values may be added to this enumeration over time.
type Easing C.gint
const (
// Linear: linear tweening.
Linear Easing = iota
// EaseInQuad: quadratic tweening.
EaseInQuad
// EaseOutQuad: quadratic tweening, inverse of ADW_EASE_IN_QUAD.
EaseOutQuad
// EaseInOutQuad: quadratic tweening, combining ADW_EASE_IN_QUAD and
// ADW_EASE_OUT_QUAD.
EaseInOutQuad
// EaseInCubic: cubic tweening.
EaseInCubic
// EaseOutCubic: cubic tweening, inverse of ADW_EASE_IN_CUBIC.
EaseOutCubic
// EaseInOutCubic: cubic tweening, combining ADW_EASE_IN_CUBIC and
// ADW_EASE_OUT_CUBIC.
EaseInOutCubic
// EaseInQuart: quartic tweening.
EaseInQuart
// EaseOutQuart: quartic tweening, inverse of ADW_EASE_IN_QUART.
EaseOutQuart
// EaseInOutQuart: quartic tweening, combining ADW_EASE_IN_QUART and
// ADW_EASE_OUT_QUART.
EaseInOutQuart
// EaseInQuint: quintic tweening.
EaseInQuint
// EaseOutQuint: quintic tweening, inverse of ADW_EASE_IN_QUINT.
EaseOutQuint
// EaseInOutQuint: quintic tweening, combining ADW_EASE_IN_QUINT and
// ADW_EASE_OUT_QUINT.
EaseInOutQuint
// EaseInSine: sine wave tweening.
EaseInSine
// EaseOutSine: sine wave tweening, inverse of ADW_EASE_IN_SINE.
EaseOutSine
// EaseInOutSine: sine wave tweening, combining ADW_EASE_IN_SINE and
// ADW_EASE_OUT_SINE.
EaseInOutSine
// EaseInExpo: exponential tweening.
EaseInExpo
// EaseOutExpo: exponential tweening, inverse of ADW_EASE_IN_EXPO.
EaseOutExpo
// EaseInOutExpo: exponential tweening, combining ADW_EASE_IN_EXPO and
// ADW_EASE_OUT_EXPO.
EaseInOutExpo
// EaseInCirc: circular tweening.
EaseInCirc
// EaseOutCirc: circular tweening, inverse of ADW_EASE_IN_CIRC.
EaseOutCirc
// EaseInOutCirc: circular tweening, combining ADW_EASE_IN_CIRC and
// ADW_EASE_OUT_CIRC.
EaseInOutCirc
// EaseInElastic: elastic tweening, with offshoot on start.
EaseInElastic
// EaseOutElastic: elastic tweening, with offshoot on end, inverse of
// ADW_EASE_IN_ELASTIC.
EaseOutElastic
// EaseInOutElastic: elastic tweening, with offshoot on both ends, combining
// ADW_EASE_IN_ELASTIC and ADW_EASE_OUT_ELASTIC.
EaseInOutElastic
// EaseInBack: overshooting cubic tweening, with backtracking on start.
EaseInBack
// EaseOutBack: overshooting cubic tweening, with backtracking on end,
// inverse of ADW_EASE_IN_BACK.
EaseOutBack
// EaseInOutBack: overshooting cubic tweening, with backtracking on both
// ends, combining ADW_EASE_IN_BACK and ADW_EASE_OUT_BACK.
EaseInOutBack
// EaseInBounce: exponentially decaying parabolic (bounce) tweening,
// on start.
EaseInBounce
// EaseOutBounce: exponentially decaying parabolic (bounce) tweening,
// with bounce on end, inverse of ADW_EASE_IN_BOUNCE.
EaseOutBounce
// EaseInOutBounce: exponentially decaying parabolic (bounce) tweening,
// with bounce on both ends, combining ADW_EASE_IN_BOUNCE and
// ADW_EASE_OUT_BOUNCE.
EaseInOutBounce
// Ease: cubic bezier tweening, with control points in (0.25, 0.1) and
// (0.25, 1.0).
//
// Increases in velocity towards the middle of the animation, slowing back
// down at the end.
Ease
// EaseIn: cubic bezier tweening, with control points in (0.42, 0.0) and
// (1.0, 1.0).
//
// Starts off slowly, with the speed of the animation increasing until
// complete.
EaseIn
// EaseOut: cubic bezier tweening, with control points in (0.0, 0.0) and
// (0.58, 1.0).
//
// Starts quickly, slowing down the animation until complete.
EaseOut
// EaseInOut: cubic bezier tweening, with control points in (0.42, 0.0) and
// (0.58, 1.0).
//
// Starts off slowly, speeds up in the middle, and then slows down again.
EaseInOut
)
func marshalEasing(p uintptr) (interface{}, error) {
return Easing(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil
}
// String returns the name in string for Easing.
func (e Easing) String() string {
switch e {
case Linear:
return "Linear"
case EaseInQuad:
return "EaseInQuad"
case EaseOutQuad:
return "EaseOutQuad"
case EaseInOutQuad:
return "EaseInOutQuad"
case EaseInCubic:
return "EaseInCubic"
case EaseOutCubic:
return "EaseOutCubic"
case EaseInOutCubic:
return "EaseInOutCubic"
case EaseInQuart:
return "EaseInQuart"
case EaseOutQuart:
return "EaseOutQuart"
case EaseInOutQuart:
return "EaseInOutQuart"
case EaseInQuint:
return "EaseInQuint"
case EaseOutQuint:
return "EaseOutQuint"
case EaseInOutQuint:
return "EaseInOutQuint"
case EaseInSine:
return "EaseInSine"
case EaseOutSine:
return "EaseOutSine"
case EaseInOutSine:
return "EaseInOutSine"
case EaseInExpo:
return "EaseInExpo"
case EaseOutExpo:
return "EaseOutExpo"
case EaseInOutExpo:
return "EaseInOutExpo"
case EaseInCirc:
return "EaseInCirc"
case EaseOutCirc:
return "EaseOutCirc"
case EaseInOutCirc:
return "EaseInOutCirc"
case EaseInElastic:
return "EaseInElastic"
case EaseOutElastic:
return "EaseOutElastic"
case EaseInOutElastic:
return "EaseInOutElastic"
case EaseInBack:
return "EaseInBack"
case EaseOutBack:
return "EaseOutBack"
case EaseInOutBack:
return "EaseInOutBack"
case EaseInBounce:
return "EaseInBounce"
case EaseOutBounce:
return "EaseOutBounce"
case EaseInOutBounce:
return "EaseInOutBounce"
case Ease:
return "Ease"
case EaseIn:
return "EaseIn"
case EaseOut:
return "EaseOut"
case EaseInOut:
return "EaseInOut"
default:
return fmt.Sprintf("Easing(%d)", e)
}
}
// EasingEase computes easing with easing for value.
//
// value should generally be in the [0, 1] range.
//
// The function takes the following parameters:
//
// - self: easing value.
// - value to ease.
//
// The function returns the following values:
//
// - gdouble: easing for value.
func EasingEase(self Easing, value float64) float64 {
var _arg1 C.AdwEasing // out
var _arg2 C.double // out
var _cret C.double // in
_arg1 = C.AdwEasing(self)
_arg2 = C.double(value)
_cret = C.adw_easing_ease(_arg1, _arg2)
runtime.KeepAlive(self)
runtime.KeepAlive(value)
var _gdouble float64 // out
_gdouble = float64(_cret)
return _gdouble
}
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"unsafe"
"github.com/diamondburned/gotk4/pkg/core/gextras"
)
// #include <stdlib.h>
// #include <adwaita.h>
import "C"
// EntryRowClass: instance of this type is always passed by reference.
type EntryRowClass struct {
*entryRowClass
}
// entryRowClass is the struct that's finalized.
type entryRowClass struct {
native *C.AdwEntryRowClass
}
// ParentClass: parent class.
func (e *EntryRowClass) ParentClass() *PreferencesRowClass {
valptr := &e.native.parent_class
var _v *PreferencesRowClass // out
_v = (*PreferencesRowClass)(gextras.NewStructNative(unsafe.Pointer(valptr)))
return _v
}
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment