v0.2.2 9100209

adw-breakpoint.go RawHistoryFolder

1// Package adw was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package adw
3
4import (
5	"structs"
6	"unsafe"
7
8	"github.com/ebitengine/purego"
9
10	"github.com/bnema/puregotk/pkg/core"
11	"github.com/bnema/puregotk/v4/glib"
12	"github.com/bnema/puregotk/v4/gobject"
13	"github.com/bnema/puregotk/v4/gobject/types"
14	"github.com/bnema/puregotk/v4/gtk"
15)
16
17type BreakpointClass struct {
18	_ structs.HostLayout
19
20	ParentClass gobject.ObjectClass
21}
22
23func (x *BreakpointClass) GoPointer() uintptr {
24	return uintptr(unsafe.Pointer(x))
25}
26
27// Describes condition for an [class@Breakpoint].
28type BreakpointCondition struct {
29	_ structs.HostLayout
30}
31
32var xBreakpointConditionGLibType func() types.GType
33
34func BreakpointConditionGLibType() types.GType {
35	return xBreakpointConditionGLibType()
36}
37
38func (x *BreakpointCondition) GoPointer() uintptr {
39	return uintptr(unsafe.Pointer(x))
40}
41
42var xNewBreakpointConditionAnd func(*BreakpointCondition, *BreakpointCondition) *BreakpointCondition
43
44// Creates a condition that triggers when @condition_1 and @condition_2 are both
45// true.
46func NewBreakpointConditionAnd(Condition1Var *BreakpointCondition, Condition2Var *BreakpointCondition) *BreakpointCondition {
47
48	cret := xNewBreakpointConditionAnd(Condition1Var, Condition2Var)
49	return cret
50}
51
52var xNewBreakpointConditionLength func(BreakpointConditionLengthType, float64, LengthUnit) *BreakpointCondition
53
54// Creates a condition that triggers on length changes.
55func NewBreakpointConditionLength(TypeVar BreakpointConditionLengthType, ValueVar float64, UnitVar LengthUnit) *BreakpointCondition {
56
57	cret := xNewBreakpointConditionLength(TypeVar, ValueVar, UnitVar)
58	return cret
59}
60
61var xNewBreakpointConditionOr func(*BreakpointCondition, *BreakpointCondition) *BreakpointCondition
62
63// Creates a condition that triggers when either @condition_1 or @condition_2 is
64// true.
65func NewBreakpointConditionOr(Condition1Var *BreakpointCondition, Condition2Var *BreakpointCondition) *BreakpointCondition {
66
67	cret := xNewBreakpointConditionOr(Condition1Var, Condition2Var)
68	return cret
69}
70
71var xNewBreakpointConditionRatio func(BreakpointConditionRatioType, int, int) *BreakpointCondition
72
73// Creates a condition that triggers on ratio changes.
74//
75// The ratio is represented as @width divided by @height.
76func NewBreakpointConditionRatio(TypeVar BreakpointConditionRatioType, WidthVar int, HeightVar int) *BreakpointCondition {
77
78	cret := xNewBreakpointConditionRatio(TypeVar, WidthVar, HeightVar)
79	return cret
80}
81
82var xBreakpointConditionCopy func(uintptr) *BreakpointCondition
83
84// Copies @self.
85func (x *BreakpointCondition) Copy() *BreakpointCondition {
86
87	cret := xBreakpointConditionCopy(x.GoPointer())
88	return cret
89}
90
91var xBreakpointConditionFree func(uintptr)
92
93// Frees @self.
94func (x *BreakpointCondition) Free() {
95
96	xBreakpointConditionFree(x.GoPointer())
97
98}
99
100var xBreakpointConditionToString func(uintptr) string
101
102// Returns a textual representation of @self.
103//
104// The returned string can be parsed by [func@BreakpointCondition.parse].
105func (x *BreakpointCondition) ToString() string {
106
107	cret := xBreakpointConditionToString(x.GoPointer())
108	return cret
109}
110
111// Describes length types for [struct@BreakpointCondition].
112//
113// See [ctor@BreakpointCondition.new_length].
114//
115// New values may be added to this enumeration over time.
116type BreakpointConditionLengthType int
117
118var xBreakpointConditionLengthTypeGLibType func() types.GType
119
120func BreakpointConditionLengthTypeGLibType() types.GType {
121	return xBreakpointConditionLengthTypeGLibType()
122}
123
124const (
125
126	// true if the width is greater than or
127	//   equal to the condition value
128	BreakpointConditionMinWidthValue BreakpointConditionLengthType = 0
129	// true if the width is less than or
130	//   equal to the condition value
131	BreakpointConditionMaxWidthValue BreakpointConditionLengthType = 1
132	// true if the height is greater than or
133	//   equal to the condition value
134	BreakpointConditionMinHeightValue BreakpointConditionLengthType = 2
135	// true if the height is less than or
136	//   equal to the condition value
137	BreakpointConditionMaxHeightValue BreakpointConditionLengthType = 3
138)
139
140// Describes ratio types for [struct@BreakpointCondition].
141//
142// See [ctor@BreakpointCondition.new_ratio].
143//
144// New values may be added to this enumeration over time.
145type BreakpointConditionRatioType int
146
147var xBreakpointConditionRatioTypeGLibType func() types.GType
148
149func BreakpointConditionRatioTypeGLibType() types.GType {
150	return xBreakpointConditionRatioTypeGLibType()
151}
152
153const (
154
155	// true if the aspect ratio is
156	//   greater than or equal to the condition value
157	BreakpointConditionMinAspectRatioValue BreakpointConditionRatioType = 0
158	// true if the aspect ratio is
159	//   less than or equal to the condition value
160	BreakpointConditionMaxAspectRatioValue BreakpointConditionRatioType = 1
161)
162
163var xBreakpointConditionParse func(string) *BreakpointCondition
164
165// Parses a condition from a string.
166//
167// Length conditions are specified as `<type>: <value>[<unit>]`, where:
168//
169// - `<type>` can be `min-width`, `max-width`, `min-height` or `max-height`
170// - `<value>` is a fractional number
171// - `<unit>` can be `px`, `pt` or `sp`
172//
173// If the unit is omitted, `px` is assumed.
174//
175// See [ctor@BreakpointCondition.new_length].
176//
177// Examples:
178//
179// - `min-width: 500px`
180// - `min-height: 400pt`
181// - `max-width: 100sp`
182// - `max-height: 500`
183//
184// Ratio conditions are specified as `<type>: <width>[/<height>]`, where:
185//
186// - `<type>` can be `min-aspect-ratio` or `max-aspect-ratio`
187// - `<width>` and `<height>` are integer numbers
188//
189// See [ctor@BreakpointCondition.new_ratio].
190//
191// The ratio is represented as `<width>` divided by `<height>`.
192//
193// If `<height>` is omitted, it's assumed to be 1.
194//
195// Examples:
196//
197// - `min-aspect-ratio: 4/3`
198// - `max-aspect-ratio: 1`
199//
200// The logical operators `and`, `or` can be used to compose a complex condition
201// as follows:
202//
203//   - `<condition> and <condition>`: the condition is true when both
204//     `<condition>`s are true, same as when using
205//     [ctor@BreakpointCondition.new_and]
206//   - `<condition> or <condition>`: the condition is true when either of the
207//     `<condition>`s is true, same as when using
208//     [ctor@BreakpointCondition.new_or]
209//
210// Examples:
211//
212// - `min-width: 400px and max-aspect-ratio: 4/3`
213// - `max-width: 360sp or max-width: 360px`
214//
215// Conditions can be further nested using parentheses, for example:
216//
217// - `min-width: 400px and (max-aspect-ratio: 4/3 or max-height: 400px)`
218//
219// If parentheses are omitted, the first operator takes priority.
220func BreakpointConditionParse(StrVar string) *BreakpointCondition {
221
222	cret := xBreakpointConditionParse(StrVar)
223	return cret
224}
225
226// Describes a breakpoint for [class@Window] or [class@Dialog].
227//
228// Breakpoints are used to create adaptive UI, allowing to change the layout
229// depending on available size.
230//
231// Breakpoint is a size threshold, specified by its condition, as well as one or
232// more setters.
233//
234// Each setter has a target object, a property and a value. When a breakpoint
235// is applied, each setter sets the target property on their target object to
236// the specified value, and reset it back to the original value when it's
237// unapplied.
238//
239// For more complicated scenarios, [signal@Breakpoint::apply] and
240// [signal@Breakpoint::unapply] can be used instead.
241//
242// Breakpoints can be used within [class@Window], [class@ApplicationWindow],
243// [class@Dialog] or [class@BreakpointBin].
244//
245// ## `AdwBreakpoint` as `GtkBuildable`:
246//
247// `AdwBreakpoint` supports specifying its condition via the `<condition>`
248// element. The contents of the element must be a string in a format accepted by
249// [func@BreakpointCondition.parse].
250//
251// It also supports adding setters via the `<setter>` element. Each `<setter>`
252// element must have the `object` attribute specifying the target object, and
253// the `property` attribute specifying the property name. The contents of the
254// element are used as the setter value.
255//
256// For `G_TYPE_OBJECT` and `G_TYPE_BOXED` derived properties, empty contents are
257// treated as `NULL`.
258//
259// Setter values can be translated with the usual `translatable`, `context` and
260// `comments` attributes.
261//
262// Example of an `AdwBreakpoint` UI definition:
263//
264// ```xml
265// <object class="AdwBreakpoint">
266//
267//	<condition>max-width: 400px</condition>
268//	<setter object="button" property="visible">True</setter>
269//	<setter object="box" property="orientation">vertical</setter>
270//	<setter object="page" property="title" translatable="yes">Example</setter>
271//
272// </object>
273// ```
274type Breakpoint struct {
275	gobject.Object
276}
277
278var xBreakpointGLibType func() types.GType
279
280func BreakpointGLibType() types.GType {
281	return xBreakpointGLibType()
282}
283
284func BreakpointNewFromInternalPtr(ptr uintptr) *Breakpoint {
285	cls := &Breakpoint{}
286	cls.Ptr = ptr
287	return cls
288}
289
290var xNewBreakpoint func(*BreakpointCondition) uintptr
291
292// Creates a new `AdwBreakpoint` with @condition.
293func NewBreakpoint(ConditionVar *BreakpointCondition) *Breakpoint {
294	var cls *Breakpoint
295
296	cret := xNewBreakpoint(ConditionVar)
297
298	if cret == 0 {
299		return nil
300	}
301	cls = &Breakpoint{}
302	cls.Ptr = cret
303	return cls
304}
305
306var xBreakpointAddSetter func(uintptr, uintptr, string, *gobject.Value)
307
308// Adds a setter to @self.
309//
310// The setter will automatically set @property on @object to @value when
311// applying the breakpoint, and set it back to its original value upon
312// unapplying it.
313//
314// ::: note
315//
316//	Setting properties to their original values does not work for properties
317//	that have irreversible side effects. For example, changing
318//	[property@Gtk.Button:label] while [property@Gtk.Button:icon-name] is set
319//	will reset the icon. However, resetting the label will not set
320//	`icon-name` to its original value.
321//
322// Use the [signal@Breakpoint::apply] and [signal@Breakpoint::unapply] signals
323// for those properties instead, as follows:
324//
325// ```c
326// static void
327// breakpoint_apply_cb (MyWidget *self)
328//
329//	{
330//	  gtk_button_set_icon_name (self->button, "go-previous-symbolic");
331//	}
332//
333// static void
334// breakpoint_apply_cb (MyWidget *self)
335//
336//	{
337//	  gtk_button_set_label (self->button, _("_Back"));
338//	}
339//
340// // ...
341//
342// g_signal_connect_swapped (breakpoint, "apply",
343//
344//	G_CALLBACK (breakpoint_apply_cb), self);
345//
346// g_signal_connect_swapped (breakpoint, "unapply",
347//
348//	G_CALLBACK (breakpoint_unapply_cb), self);
349//
350// ```
351func (x *Breakpoint) AddSetter(ObjectVar *gobject.Object, PropertyVar string, ValueVar *gobject.Value) {
352
353	xBreakpointAddSetter(x.GoPointer(), ObjectVar.GoPointer(), PropertyVar, ValueVar)
354
355}
356
357var xBreakpointAddSetters func(uintptr, uintptr, string, ...interface{})
358
359// Adds multiple setters to @self.
360//
361// See [method@Breakpoint.add_setter].
362//
363// Example:
364//
365// ```c
366// adw_breakpoint_add_setters (breakpoint,
367//
368//	G_OBJECT (box), "orientation", GTK_ORIENTATION_VERTICAL,
369//	G_OBJECT (button), "halign", GTK_ALIGN_FILL,
370//	G_OBJECT (button), "valign", GTK_ALIGN_END,
371//	NULL);
372//
373// ```
374func (x *Breakpoint) AddSetters(FirstObjectVar *gobject.Object, FirstPropertyVar string, varArgs ...interface{}) {
375
376	xBreakpointAddSetters(x.GoPointer(), FirstObjectVar.GoPointer(), FirstPropertyVar, varArgs...)
377
378}
379
380var xBreakpointAddSettersValist func(uintptr, uintptr, string, []interface{})
381
382// Adds multiple setters to @self.
383//
384// See [method@Breakpoint.add_setters].
385func (x *Breakpoint) AddSettersValist(FirstObjectVar *gobject.Object, FirstPropertyVar string, ArgsVar []interface{}) {
386
387	xBreakpointAddSettersValist(x.GoPointer(), FirstObjectVar.GoPointer(), FirstPropertyVar, ArgsVar)
388
389}
390
391var xBreakpointAddSettersv func(uintptr, int, uintptr, []string, uintptr)
392
393// Adds @n_setters setters to @self.
394//
395// This is a convenience function for adding multiple setters at once.
396//
397// See [method@Breakpoint.add_setter].
398//
399// This function is meant to be used by language bindings.
400func (x *Breakpoint) AddSettersv(NSettersVar int, ObjectsVar uintptr, NamesVar []string, ValuesVar uintptr) {
401
402	xBreakpointAddSettersv(x.GoPointer(), NSettersVar, ObjectsVar, NamesVar, ValuesVar)
403
404}
405
406var xBreakpointGetCondition func(uintptr) *BreakpointCondition
407
408// Gets the condition for @self.
409func (x *Breakpoint) GetCondition() *BreakpointCondition {
410
411	cret := xBreakpointGetCondition(x.GoPointer())
412	return cret
413}
414
415var xBreakpointSetCondition func(uintptr, *BreakpointCondition)
416
417// Sets the condition for @self.
418func (x *Breakpoint) SetCondition(ConditionVar *BreakpointCondition) {
419
420	xBreakpointSetCondition(x.GoPointer(), ConditionVar)
421
422}
423
424func (c *Breakpoint) GoPointer() uintptr {
425	if c == nil {
426		return 0
427	}
428	return c.Ptr
429}
430
431func (c *Breakpoint) SetGoPointer(ptr uintptr) {
432	c.Ptr = ptr
433}
434
435// SetPropertyCondition sets the "condition" property.
436// The breakpoint's condition.
437func (x *Breakpoint) SetPropertyCondition(value uintptr) {
438	var v gobject.Value
439	v.Init(gobject.TypePointerVal)
440	v.SetPointer(value)
441	x.SetProperty("condition", &v)
442}
443
444// GetPropertyCondition gets the "condition" property.
445// The breakpoint's condition.
446func (x *Breakpoint) GetPropertyCondition() uintptr {
447	var v gobject.Value
448	x.GetProperty("condition", &v)
449	return v.GetPointer()
450}
451
452// Emitted when the breakpoint is applied.
453//
454// This signal is emitted after the setters have been applied.
455func (x *Breakpoint) ConnectApply(cb *func(Breakpoint)) uint {
456	cbPtr := uintptr(unsafe.Pointer(cb))
457	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
458		handlerID := gobject.SignalConnect(x.GoPointer(), "apply", cbRefPtr)
459		glib.SaveHandlerMapping(handlerID, cbPtr)
460		return handlerID
461	}
462
463	fcb := func(clsPtr uintptr) {
464		fa := Breakpoint{}
465		fa.Ptr = clsPtr
466		cbFn := *cb
467
468		cbFn(fa)
469
470	}
471	cbRefPtr := purego.NewCallback(fcb)
472	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
473	handlerID := gobject.SignalConnect(x.GoPointer(), "apply", cbRefPtr)
474	glib.SaveHandlerMapping(handlerID, cbPtr)
475	return handlerID
476}
477
478// Emitted when the breakpoint is unapplied.
479//
480// This signal is emitted before resetting the setter values.
481func (x *Breakpoint) ConnectUnapply(cb *func(Breakpoint)) uint {
482	cbPtr := uintptr(unsafe.Pointer(cb))
483	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
484		handlerID := gobject.SignalConnect(x.GoPointer(), "unapply", cbRefPtr)
485		glib.SaveHandlerMapping(handlerID, cbPtr)
486		return handlerID
487	}
488
489	fcb := func(clsPtr uintptr) {
490		fa := Breakpoint{}
491		fa.Ptr = clsPtr
492		cbFn := *cb
493
494		cbFn(fa)
495
496	}
497	cbRefPtr := purego.NewCallback(fcb)
498	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
499	handlerID := gobject.SignalConnect(x.GoPointer(), "unapply", cbRefPtr)
500	glib.SaveHandlerMapping(handlerID, cbPtr)
501	return handlerID
502}
503
504// Gets the ID of the @buildable object.
505//
506// `GtkBuilder` sets the name based on the ID attribute
507// of the `<object>` tag used to construct the @buildable.
508func (x *Breakpoint) GetBuildableId() string {
509
510	cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer())
511	return cret
512}
513
514func init() {
515	core.SetPackageName("ADW", "libadwaita-1")
516	core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"})
517	var libs []uintptr
518	for _, libPath := range core.GetPaths("ADW") {
519		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
520		if err != nil {
521			panic(err)
522		}
523		libs = append(libs, lib)
524	}
525
526	core.PuregoSafeRegister(&xBreakpointConditionLengthTypeGLibType, libs, "adw_breakpoint_condition_length_type_get_type")
527
528	core.PuregoSafeRegister(&xBreakpointConditionRatioTypeGLibType, libs, "adw_breakpoint_condition_ratio_type_get_type")
529
530	core.PuregoSafeRegister(&xBreakpointConditionParse, libs, "adw_breakpoint_condition_parse")
531
532	core.PuregoSafeRegister(&xBreakpointConditionGLibType, libs, "adw_breakpoint_condition_get_type")
533
534	core.PuregoSafeRegister(&xNewBreakpointConditionAnd, libs, "adw_breakpoint_condition_new_and")
535	core.PuregoSafeRegister(&xNewBreakpointConditionLength, libs, "adw_breakpoint_condition_new_length")
536	core.PuregoSafeRegister(&xNewBreakpointConditionOr, libs, "adw_breakpoint_condition_new_or")
537	core.PuregoSafeRegister(&xNewBreakpointConditionRatio, libs, "adw_breakpoint_condition_new_ratio")
538
539	core.PuregoSafeRegister(&xBreakpointConditionCopy, libs, "adw_breakpoint_condition_copy")
540	core.PuregoSafeRegister(&xBreakpointConditionFree, libs, "adw_breakpoint_condition_free")
541	core.PuregoSafeRegister(&xBreakpointConditionToString, libs, "adw_breakpoint_condition_to_string")
542
543	core.PuregoSafeRegister(&xBreakpointGLibType, libs, "adw_breakpoint_get_type")
544
545	core.PuregoSafeRegister(&xNewBreakpoint, libs, "adw_breakpoint_new")
546
547	core.PuregoSafeRegister(&xBreakpointAddSetter, libs, "adw_breakpoint_add_setter")
548	core.PuregoSafeRegister(&xBreakpointAddSetters, libs, "adw_breakpoint_add_setters")
549	core.PuregoSafeRegister(&xBreakpointAddSettersValist, libs, "adw_breakpoint_add_setters_valist")
550	core.PuregoSafeRegister(&xBreakpointAddSettersv, libs, "adw_breakpoint_add_settersv")
551	core.PuregoSafeRegister(&xBreakpointGetCondition, libs, "adw_breakpoint_get_condition")
552	core.PuregoSafeRegister(&xBreakpointSetCondition, libs, "adw_breakpoint_set_condition")
553
554}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close