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/gobject"
12 "github.com/bnema/puregotk/v4/gobject/types"
13 "github.com/bnema/puregotk/v4/gtk"
14)
15
16type BreakpointBinClass struct {
17 _ structs.HostLayout
18
19 ParentClass gtk.WidgetClass
20
21 Padding [4]uintptr
22}
23
24func (x *BreakpointBinClass) GoPointer() uintptr {
25 return uintptr(unsafe.Pointer(x))
26}
27
28// A widget that changes layout based on available size.
29//
30// <picture>
31//
32// <source srcset="breakpoint-bin-dark.png" media="(prefers-color-scheme: dark)">
33// <img src="breakpoint-bin.png" alt="breakpoint-bin">
34//
35// </picture>
36//
37// `AdwBreakpointBin` provides a way to use breakpoints without [class@Window],
38// [class@ApplicationWindow] or [class@Dialog]. It can be useful for limiting
39// breakpoints to a single page and similar purposes. Most applications
40// shouldn't need it.
41//
42// `AdwBreakpointBin` is similar to [class@Bin]. It has one child, set via the
43// [property@BreakpointBin:child] property.
44//
45// When `AdwBreakpointBin` is resized, its child widget can rearrange its layout
46// at specific thresholds.
47//
48// The thresholds and layout changes are defined via [class@Breakpoint] objects.
49// They can be added using [method@BreakpointBin.add_breakpoint].
50//
51// Each breakpoint has a condition, specifying the bin's size and/or aspect
52// ratio, and setters that automatically set object properties when that
53// happens. The [signal@Breakpoint::apply] and [signal@Breakpoint::unapply] can
54// be used instead for more complex scenarios.
55//
56// Breakpoints are only allowed to modify widgets inside the `AdwBreakpointBin`,
57// but not on the `AdwBreakpointBin` itself or any other widgets.
58//
59// If multiple breakpoints can be used for the current size, the last one is
60// always picked. The current breakpoint can be tracked using the
61// [property@BreakpointBin:current-breakpoint] property.
62//
63// If none of the breakpoints can be used, that property will be set to `NULL`,
64// and the original property values will be used instead.
65//
66// ## Minimum Size
67//
68// Adding a breakpoint to `AdwBreakpointBin` will result in it having no minimum
69// size. The [property@Gtk.Widget:width-request] and
70// [property@Gtk.Widget:height-request] properties must always be set when using
71// breakpoints, indicating the smallest size you want to support.
72//
73// The minimum size and breakpoint conditions must be carefully selected so that
74// the child widget completely fits. If it doesn't, it will overflow and a
75// warning message will be printed.
76//
77// When choosing minimum size, consider translations and text scale factor
78// changes. Make sure to leave enough space for text labels, and enable
79// ellipsizing or wrapping if they might not fit.
80//
81// For [class@Gtk.Label] this can be done via [property@Gtk.Label:ellipsize], or
82// via [property@Gtk.Label:wrap] together with [property@Gtk.Label:wrap-mode].
83//
84// For buttons, use [property@Gtk.Button:can-shrink],
85// [property@Gtk.MenuButton:can-shrink], [property@Adw.SplitButton:can-shrink],
86// or [property@Adw.ButtonContent:can-shrink].
87//
88// ## Example
89//
90// ```c
91// GtkWidget *bin, *child;
92// AdwBreakpoint *breakpoint;
93//
94// bin = adw_breakpoint_bin_new ();
95// gtk_widget_set_size_request (bin, 150, 150);
96//
97// child = gtk_label_new ("Wide");
98// gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
99// gtk_widget_add_css_class (child, "title-1");
100// adw_breakpoint_bin_set_child (ADW_BREAKPOINT_BIN (bin), child);
101//
102// breakpoint = adw_breakpoint_new (adw_breakpoint_condition_parse ("max-width: 200px"));
103// adw_breakpoint_add_setters (breakpoint,
104//
105// G_OBJECT (child), "label", "Narrow",
106// NULL);
107//
108// adw_breakpoint_bin_add_breakpoint (ADW_BREAKPOINT_BIN (bin), breakpoint);
109// ```
110//
111// The bin has a single label inside it, displaying "Wide". When the bin's width
112// is smaller than or equal to 200px, it changes to "Narrow".
113//
114// ## `AdwBreakpointBin` as `GtkBuildable`
115//
116// `AdwBreakpointBin` allows adding `AdwBreakpoint` objects as children.
117//
118// Example of an `AdwBreakpointBin` UI definition:
119//
120// ```xml
121// <object class="AdwBreakpointBin">
122//
123// <property name="width-request">150</property>
124// <property name="height-request">150</property>
125// <property name="child">
126// <object class="GtkLabel" id="child">
127// <property name="label">Wide</property>
128// <property name="ellipsize">end</property>
129// <style>
130// <class name="title-1"/>
131// </style>
132// </object>
133// </property>
134// <child>
135// <object class="AdwBreakpoint">
136// <condition>max-width: 200px</condition>
137// <setter object="child" property="label">Narrow</setter>
138// </object>
139// </child>
140//
141// </object>
142// ```
143//
144// See [class@Breakpoint] documentation for details.
145type BreakpointBin struct {
146 gtk.Widget
147}
148
149var xBreakpointBinGLibType func() types.GType
150
151func BreakpointBinGLibType() types.GType {
152 return xBreakpointBinGLibType()
153}
154
155func BreakpointBinNewFromInternalPtr(ptr uintptr) *BreakpointBin {
156 cls := &BreakpointBin{}
157 cls.Ptr = ptr
158 return cls
159}
160
161var xNewBreakpointBin func() uintptr
162
163// Creates a new `AdwBreakpointBin`.
164func NewBreakpointBin() *BreakpointBin {
165 var cls *BreakpointBin
166
167 cret := xNewBreakpointBin()
168
169 if cret == 0 {
170 return nil
171 }
172 gobject.IncreaseRef(cret)
173 cls = &BreakpointBin{}
174 cls.Ptr = cret
175 return cls
176}
177
178var xBreakpointBinAddBreakpoint func(uintptr, uintptr)
179
180// Adds @breakpoint to @self.
181func (x *BreakpointBin) AddBreakpoint(BreakpointVar *Breakpoint) {
182
183 xBreakpointBinAddBreakpoint(x.GoPointer(), BreakpointVar.GoPointer())
184
185}
186
187var xBreakpointBinGetChild func(uintptr) uintptr
188
189// Gets the child widget of @self.
190func (x *BreakpointBin) GetChild() *gtk.Widget {
191 var cls *gtk.Widget
192
193 cret := xBreakpointBinGetChild(x.GoPointer())
194
195 if cret == 0 {
196 return nil
197 }
198 gobject.IncreaseRef(cret)
199 cls = >k.Widget{}
200 cls.Ptr = cret
201 return cls
202}
203
204var xBreakpointBinGetCurrentBreakpoint func(uintptr) uintptr
205
206// Gets the current breakpoint.
207func (x *BreakpointBin) GetCurrentBreakpoint() *Breakpoint {
208 var cls *Breakpoint
209
210 cret := xBreakpointBinGetCurrentBreakpoint(x.GoPointer())
211
212 if cret == 0 {
213 return nil
214 }
215 gobject.IncreaseRef(cret)
216 cls = &Breakpoint{}
217 cls.Ptr = cret
218 return cls
219}
220
221var xBreakpointBinRemoveBreakpoint func(uintptr, uintptr)
222
223// Removes @breakpoint from @self.
224func (x *BreakpointBin) RemoveBreakpoint(BreakpointVar *Breakpoint) {
225
226 xBreakpointBinRemoveBreakpoint(x.GoPointer(), BreakpointVar.GoPointer())
227
228}
229
230var xBreakpointBinSetChild func(uintptr, uintptr)
231
232// Sets the child widget of @self.
233func (x *BreakpointBin) SetChild(ChildVar *gtk.Widget) {
234
235 xBreakpointBinSetChild(x.GoPointer(), ChildVar.GoPointer())
236
237}
238
239func (c *BreakpointBin) GoPointer() uintptr {
240 if c == nil {
241 return 0
242 }
243 return c.Ptr
244}
245
246func (c *BreakpointBin) SetGoPointer(ptr uintptr) {
247 c.Ptr = ptr
248}
249
250// Requests the user's screen reader to announce the given message.
251//
252// This kind of notification is useful for messages that
253// either have only a visual representation or that are not
254// exposed visually at all, e.g. a notification about a
255// successful operation.
256//
257// Also, by using this API, you can ensure that the message
258// does not interrupts the user's current screen reader output.
259func (x *BreakpointBin) Announce(MessageVar string, PriorityVar gtk.AccessibleAnnouncementPriority) {
260
261 gtk.XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
262
263}
264
265// Retrieves the accessible parent for an accessible object.
266//
267// This function returns `NULL` for top level widgets.
268func (x *BreakpointBin) GetAccessibleParent() *gtk.AccessibleBase {
269 var cls *gtk.AccessibleBase
270
271 cret := gtk.XGtkAccessibleGetAccessibleParent(x.GoPointer())
272
273 if cret == 0 {
274 return nil
275 }
276 cls = >k.AccessibleBase{}
277 cls.Ptr = cret
278 return cls
279}
280
281// Retrieves the accessible role of an accessible object.
282func (x *BreakpointBin) GetAccessibleRole() gtk.AccessibleRole {
283
284 cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer())
285 return cret
286}
287
288// Retrieves the implementation for the given accessible object.
289func (x *BreakpointBin) GetAtContext() *gtk.ATContext {
290 var cls *gtk.ATContext
291
292 cret := gtk.XGtkAccessibleGetAtContext(x.GoPointer())
293
294 if cret == 0 {
295 return nil
296 }
297 cls = >k.ATContext{}
298 cls.Ptr = cret
299 return cls
300}
301
302// Queries the coordinates and dimensions of this accessible
303//
304// This functionality can be overridden by `GtkAccessible`
305// implementations, e.g. to get the bounds from an ignored
306// child widget.
307func (x *BreakpointBin) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
308
309 cret := gtk.XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
310 return cret
311}
312
313// Retrieves the first accessible child of an accessible object.
314func (x *BreakpointBin) GetFirstAccessibleChild() *gtk.AccessibleBase {
315 var cls *gtk.AccessibleBase
316
317 cret := gtk.XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
318
319 if cret == 0 {
320 return nil
321 }
322 cls = >k.AccessibleBase{}
323 cls.Ptr = cret
324 return cls
325}
326
327// Retrieves the next accessible sibling of an accessible object
328func (x *BreakpointBin) GetNextAccessibleSibling() *gtk.AccessibleBase {
329 var cls *gtk.AccessibleBase
330
331 cret := gtk.XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
332
333 if cret == 0 {
334 return nil
335 }
336 cls = >k.AccessibleBase{}
337 cls.Ptr = cret
338 return cls
339}
340
341// Queries a platform state, such as focus.
342//
343// This functionality can be overridden by `GtkAccessible`
344// implementations, e.g. to get platform state from an ignored
345// child widget, as is the case for `GtkText` wrappers.
346func (x *BreakpointBin) GetPlatformState(StateVar gtk.AccessiblePlatformState) bool {
347
348 cret := gtk.XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
349 return cret
350}
351
352// Resets the accessible property to its default value.
353func (x *BreakpointBin) ResetProperty(PropertyVar gtk.AccessibleProperty) {
354
355 gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
356
357}
358
359// Resets the accessible relation to its default value.
360func (x *BreakpointBin) ResetRelation(RelationVar gtk.AccessibleRelation) {
361
362 gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
363
364}
365
366// Resets the accessible state to its default value.
367func (x *BreakpointBin) ResetState(StateVar gtk.AccessibleState) {
368
369 gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar)
370
371}
372
373// Sets the parent and sibling of an accessible object.
374//
375// This function is meant to be used by accessible implementations that are
376// not part of the widget hierarchy, and but act as a logical bridge between
377// widgets. For instance, if a widget creates an object that holds metadata
378// for each child, and you want that object to implement the `GtkAccessible`
379// interface, you will use this function to ensure that the parent of each
380// child widget is the metadata object, and the parent of each metadata
381// object is the container widget.
382func (x *BreakpointBin) SetAccessibleParent(ParentVar gtk.Accessible, NextSiblingVar gtk.Accessible) {
383
384 gtk.XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
385
386}
387
388// Updates the next accessible sibling.
389//
390// That might be useful when a new child of a custom accessible
391// is created, and it needs to be linked to a previous child.
392func (x *BreakpointBin) UpdateNextAccessibleSibling(NewSiblingVar gtk.Accessible) {
393
394 gtk.XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
395
396}
397
398// Informs ATs that the platform state has changed.
399//
400// This function should be used by `GtkAccessible` implementations that
401// have a platform state but are not widgets. Widgets handle platform
402// states automatically.
403func (x *BreakpointBin) UpdatePlatformState(StateVar gtk.AccessiblePlatformState) {
404
405 gtk.XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
406
407}
408
409// Updates a list of accessible properties.
410//
411// See the [enum@Gtk.AccessibleProperty] documentation for the
412// value types of accessible properties.
413//
414// This function should be called by `GtkWidget` types whenever
415// an accessible property change must be communicated to assistive
416// technologies.
417//
418// Example:
419// ```c
420// value = gtk_adjustment_get_value (adjustment);
421// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
422//
423// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
424// -1);
425//
426// ```
427func (x *BreakpointBin) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) {
428
429 gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
430
431}
432
433// Updates an array of accessible properties.
434//
435// This function should be called by `GtkWidget` types whenever an accessible
436// property change must be communicated to assistive technologies.
437//
438// This function is meant to be used by language bindings.
439func (x *BreakpointBin) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) {
440
441 gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
442
443}
444
445// Updates a list of accessible relations.
446//
447// This function should be called by `GtkWidget` types whenever an accessible
448// relation change must be communicated to assistive technologies.
449//
450// If the [enum@Gtk.AccessibleRelation] requires a list of references,
451// you should pass each reference individually, followed by `NULL`, e.g.
452//
453// ```c
454// gtk_accessible_update_relation (accessible,
455//
456// GTK_ACCESSIBLE_RELATION_CONTROLS,
457// ref1, NULL,
458// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
459// ref1, ref2, ref3, NULL,
460// -1);
461//
462// ```
463func (x *BreakpointBin) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) {
464
465 gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
466
467}
468
469// Updates an array of accessible relations.
470//
471// This function should be called by `GtkWidget` types whenever an accessible
472// relation change must be communicated to assistive technologies.
473//
474// This function is meant to be used by language bindings.
475func (x *BreakpointBin) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) {
476
477 gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
478
479}
480
481// Updates a list of accessible states.
482//
483// See the [enum@Gtk.AccessibleState] documentation for the
484// value types of accessible states.
485//
486// This function should be called by `GtkWidget` types whenever
487// an accessible state change must be communicated to assistive
488// technologies.
489//
490// Example:
491//
492// ```c
493// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
494// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
495//
496// GTK_ACCESSIBLE_STATE_CHECKED, value,
497// -1);
498//
499// ```
500func (x *BreakpointBin) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) {
501
502 gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
503
504}
505
506// Updates an array of accessible states.
507//
508// This function should be called by `GtkWidget` types whenever an accessible
509// state change must be communicated to assistive technologies.
510//
511// This function is meant to be used by language bindings.
512func (x *BreakpointBin) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) {
513
514 gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
515
516}
517
518// Gets the ID of the @buildable object.
519//
520// `GtkBuilder` sets the name based on the ID attribute
521// of the `<object>` tag used to construct the @buildable.
522func (x *BreakpointBin) GetBuildableId() string {
523
524 cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer())
525 return cret
526}
527
528func init() {
529 core.SetPackageName("ADW", "libadwaita-1")
530 core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"})
531 var libs []uintptr
532 for _, libPath := range core.GetPaths("ADW") {
533 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
534 if err != nil {
535 panic(err)
536 }
537 libs = append(libs, lib)
538 }
539
540 core.PuregoSafeRegister(&xBreakpointBinGLibType, libs, "adw_breakpoint_bin_get_type")
541
542 core.PuregoSafeRegister(&xNewBreakpointBin, libs, "adw_breakpoint_bin_new")
543
544 core.PuregoSafeRegister(&xBreakpointBinAddBreakpoint, libs, "adw_breakpoint_bin_add_breakpoint")
545 core.PuregoSafeRegister(&xBreakpointBinGetChild, libs, "adw_breakpoint_bin_get_child")
546 core.PuregoSafeRegister(&xBreakpointBinGetCurrentBreakpoint, libs, "adw_breakpoint_bin_get_current_breakpoint")
547 core.PuregoSafeRegister(&xBreakpointBinRemoveBreakpoint, libs, "adw_breakpoint_bin_remove_breakpoint")
548 core.PuregoSafeRegister(&xBreakpointBinSetChild, libs, "adw_breakpoint_bin_set_child")
549
550}