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 ViewSwitcherTitleClass struct {
17 _ structs.HostLayout
18
19 ParentClass gtk.WidgetClass
20}
21
22func (x *ViewSwitcherTitleClass) GoPointer() uintptr {
23 return uintptr(unsafe.Pointer(x))
24}
25
26// A view switcher title.
27//
28// <picture>
29//
30// <source srcset="view-switcher-title-dark.png" media="(prefers-color-scheme: dark)">
31// <img src="view-switcher-title.png" alt="view-switcher-title">
32//
33// </picture>
34//
35// A widget letting you switch between multiple views contained by a
36// [class@ViewStack] via an [class@ViewSwitcher].
37//
38// It is designed to be used as the title widget of a [class@HeaderBar], and
39// will display the window's title when the window is too narrow to fit the view
40// switcher e.g. on mobile phones, or if there are less than two views.
41//
42// In order to center the title in narrow windows, the header bar should have
43// [property@HeaderBar:centering-policy] set to
44// `ADW_CENTERING_POLICY_STRICT`.
45//
46// `AdwViewSwitcherTitle` is intended to be used together with
47// [class@ViewSwitcherBar].
48//
49// A common use case is to bind the [property@ViewSwitcherBar:reveal] property
50// to [property@ViewSwitcherTitle:title-visible] to automatically reveal the
51// view switcher bar when the title label is displayed in place of the view
52// switcher, as follows:
53//
54// ```xml
55// <object class="AdwWindow">
56//
57// <property name="content">
58// <object class="AdwToolbarView">
59// <child type="top">
60// <object class="AdwHeaderBar">
61// <property name="centering-policy">strict</property>
62// <property name="title-widget">
63// <object class="AdwViewSwitcherTitle" id="title">
64// <property name="stack">stack</property>
65// </object>
66// </property>
67// </object>
68// </child>
69// <property name="content">
70// <object class="AdwViewStack" id="stack"/>
71// </property>
72// <child type="bottom">
73// <object class="AdwViewSwitcherBar">
74// <property name="stack">stack</property>
75// <binding name="reveal">
76// <lookup name="title-visible">title</lookup>
77// </binding>
78// </object>
79// </child>
80// </object>
81// </property>
82//
83// </object>
84// ```
85//
86// ## CSS nodes
87//
88// `AdwViewSwitcherTitle` has a single CSS node with name `viewswitchertitle`.
89type ViewSwitcherTitle struct {
90 gtk.Widget
91}
92
93var xViewSwitcherTitleGLibType func() types.GType
94
95func ViewSwitcherTitleGLibType() types.GType {
96 return xViewSwitcherTitleGLibType()
97}
98
99func ViewSwitcherTitleNewFromInternalPtr(ptr uintptr) *ViewSwitcherTitle {
100 cls := &ViewSwitcherTitle{}
101 cls.Ptr = ptr
102 return cls
103}
104
105var xNewViewSwitcherTitle func() uintptr
106
107// Creates a new `AdwViewSwitcherTitle`.
108func NewViewSwitcherTitle() *ViewSwitcherTitle {
109 var cls *ViewSwitcherTitle
110
111 cret := xNewViewSwitcherTitle()
112
113 if cret == 0 {
114 return nil
115 }
116 gobject.IncreaseRef(cret)
117 cls = &ViewSwitcherTitle{}
118 cls.Ptr = cret
119 return cls
120}
121
122var xViewSwitcherTitleGetStack func(uintptr) uintptr
123
124// Gets the stack controlled by @self.
125func (x *ViewSwitcherTitle) GetStack() *ViewStack {
126 var cls *ViewStack
127
128 cret := xViewSwitcherTitleGetStack(x.GoPointer())
129
130 if cret == 0 {
131 return nil
132 }
133 gobject.IncreaseRef(cret)
134 cls = &ViewStack{}
135 cls.Ptr = cret
136 return cls
137}
138
139var xViewSwitcherTitleGetSubtitle func(uintptr) string
140
141// Gets the subtitle of @self.
142func (x *ViewSwitcherTitle) GetSubtitle() string {
143
144 cret := xViewSwitcherTitleGetSubtitle(x.GoPointer())
145 return cret
146}
147
148var xViewSwitcherTitleGetTitle func(uintptr) string
149
150// Gets the title of @self.
151func (x *ViewSwitcherTitle) GetTitle() string {
152
153 cret := xViewSwitcherTitleGetTitle(x.GoPointer())
154 return cret
155}
156
157var xViewSwitcherTitleGetTitleVisible func(uintptr) bool
158
159// Gets whether the title of @self is currently visible.
160//
161// If the title is visible, it means the view switcher is hidden an it may be
162// wanted to show an alternative switcher, e.g. a [class@ViewSwitcherBar].
163func (x *ViewSwitcherTitle) GetTitleVisible() bool {
164
165 cret := xViewSwitcherTitleGetTitleVisible(x.GoPointer())
166 return cret
167}
168
169var xViewSwitcherTitleGetViewSwitcherEnabled func(uintptr) bool
170
171// Gets whether @self's view switcher is enabled.
172func (x *ViewSwitcherTitle) GetViewSwitcherEnabled() bool {
173
174 cret := xViewSwitcherTitleGetViewSwitcherEnabled(x.GoPointer())
175 return cret
176}
177
178var xViewSwitcherTitleSetStack func(uintptr, uintptr)
179
180// Sets the stack controlled by @self.
181func (x *ViewSwitcherTitle) SetStack(StackVar *ViewStack) {
182
183 xViewSwitcherTitleSetStack(x.GoPointer(), StackVar.GoPointer())
184
185}
186
187var xViewSwitcherTitleSetSubtitle func(uintptr, string)
188
189// Sets the subtitle of @self.
190//
191// The subtitle should give the user additional details.
192func (x *ViewSwitcherTitle) SetSubtitle(SubtitleVar string) {
193
194 xViewSwitcherTitleSetSubtitle(x.GoPointer(), SubtitleVar)
195
196}
197
198var xViewSwitcherTitleSetTitle func(uintptr, string)
199
200// Sets the title of @self.
201//
202// The title typically identifies the current view or content item, and
203// generally does not use the application name.
204func (x *ViewSwitcherTitle) SetTitle(TitleVar string) {
205
206 xViewSwitcherTitleSetTitle(x.GoPointer(), TitleVar)
207
208}
209
210var xViewSwitcherTitleSetViewSwitcherEnabled func(uintptr, bool)
211
212// Sets whether @self's view switcher is enabled.
213//
214// If it is disabled, the title will be displayed instead. This allows to
215// programmatically hide the view switcher even if it fits in the available
216// space.
217//
218// This can be used e.g. to ensure the view switcher is hidden below a certain
219// window width, or any other constraint you find suitable.
220func (x *ViewSwitcherTitle) SetViewSwitcherEnabled(EnabledVar bool) {
221
222 xViewSwitcherTitleSetViewSwitcherEnabled(x.GoPointer(), EnabledVar)
223
224}
225
226func (c *ViewSwitcherTitle) GoPointer() uintptr {
227 if c == nil {
228 return 0
229 }
230 return c.Ptr
231}
232
233func (c *ViewSwitcherTitle) SetGoPointer(ptr uintptr) {
234 c.Ptr = ptr
235}
236
237// SetPropertySubtitle sets the "subtitle" property.
238// The subtitle to display.
239//
240// The subtitle should give the user additional details.
241func (x *ViewSwitcherTitle) SetPropertySubtitle(value string) {
242 var v gobject.Value
243 v.Init(gobject.TypeStringVal)
244 v.SetString(&value)
245 x.SetProperty("subtitle", &v)
246}
247
248// GetPropertySubtitle gets the "subtitle" property.
249// The subtitle to display.
250//
251// The subtitle should give the user additional details.
252func (x *ViewSwitcherTitle) GetPropertySubtitle() string {
253 var v gobject.Value
254 x.GetProperty("subtitle", &v)
255 return v.GetString()
256}
257
258// SetPropertyTitle sets the "title" property.
259// The title to display.
260//
261// The title typically identifies the current view or content item, and
262// generally does not use the application name.
263func (x *ViewSwitcherTitle) SetPropertyTitle(value string) {
264 var v gobject.Value
265 v.Init(gobject.TypeStringVal)
266 v.SetString(&value)
267 x.SetProperty("title", &v)
268}
269
270// GetPropertyTitle gets the "title" property.
271// The title to display.
272//
273// The title typically identifies the current view or content item, and
274// generally does not use the application name.
275func (x *ViewSwitcherTitle) GetPropertyTitle() string {
276 var v gobject.Value
277 x.GetProperty("title", &v)
278 return v.GetString()
279}
280
281// GetPropertyTitleVisible gets the "title-visible" property.
282// Whether the title is currently visible.
283//
284// If the title is visible, it means the view switcher is hidden an it may be
285// wanted to show an alternative switcher, e.g. a [class@ViewSwitcherBar].
286func (x *ViewSwitcherTitle) GetPropertyTitleVisible() bool {
287 var v gobject.Value
288 x.GetProperty("title-visible", &v)
289 return v.GetBoolean()
290}
291
292// SetPropertyViewSwitcherEnabled sets the "view-switcher-enabled" property.
293// Whether the view switcher is enabled.
294//
295// If it is disabled, the title will be displayed instead. This allows to
296// programmatically hide the view switcher even if it fits in the available
297// space.
298//
299// This can be used e.g. to ensure the view switcher is hidden below a certain
300// window width, or any other constraint you find suitable.
301func (x *ViewSwitcherTitle) SetPropertyViewSwitcherEnabled(value bool) {
302 var v gobject.Value
303 v.Init(gobject.TypeBooleanVal)
304 v.SetBoolean(value)
305 x.SetProperty("view-switcher-enabled", &v)
306}
307
308// GetPropertyViewSwitcherEnabled gets the "view-switcher-enabled" property.
309// Whether the view switcher is enabled.
310//
311// If it is disabled, the title will be displayed instead. This allows to
312// programmatically hide the view switcher even if it fits in the available
313// space.
314//
315// This can be used e.g. to ensure the view switcher is hidden below a certain
316// window width, or any other constraint you find suitable.
317func (x *ViewSwitcherTitle) GetPropertyViewSwitcherEnabled() bool {
318 var v gobject.Value
319 x.GetProperty("view-switcher-enabled", &v)
320 return v.GetBoolean()
321}
322
323// Requests the user's screen reader to announce the given message.
324//
325// This kind of notification is useful for messages that
326// either have only a visual representation or that are not
327// exposed visually at all, e.g. a notification about a
328// successful operation.
329//
330// Also, by using this API, you can ensure that the message
331// does not interrupts the user's current screen reader output.
332func (x *ViewSwitcherTitle) Announce(MessageVar string, PriorityVar gtk.AccessibleAnnouncementPriority) {
333
334 gtk.XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
335
336}
337
338// Retrieves the accessible parent for an accessible object.
339//
340// This function returns `NULL` for top level widgets.
341func (x *ViewSwitcherTitle) GetAccessibleParent() *gtk.AccessibleBase {
342 var cls *gtk.AccessibleBase
343
344 cret := gtk.XGtkAccessibleGetAccessibleParent(x.GoPointer())
345
346 if cret == 0 {
347 return nil
348 }
349 cls = >k.AccessibleBase{}
350 cls.Ptr = cret
351 return cls
352}
353
354// Retrieves the accessible role of an accessible object.
355func (x *ViewSwitcherTitle) GetAccessibleRole() gtk.AccessibleRole {
356
357 cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer())
358 return cret
359}
360
361// Retrieves the implementation for the given accessible object.
362func (x *ViewSwitcherTitle) GetAtContext() *gtk.ATContext {
363 var cls *gtk.ATContext
364
365 cret := gtk.XGtkAccessibleGetAtContext(x.GoPointer())
366
367 if cret == 0 {
368 return nil
369 }
370 cls = >k.ATContext{}
371 cls.Ptr = cret
372 return cls
373}
374
375// Queries the coordinates and dimensions of this accessible
376//
377// This functionality can be overridden by `GtkAccessible`
378// implementations, e.g. to get the bounds from an ignored
379// child widget.
380func (x *ViewSwitcherTitle) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
381
382 cret := gtk.XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
383 return cret
384}
385
386// Retrieves the first accessible child of an accessible object.
387func (x *ViewSwitcherTitle) GetFirstAccessibleChild() *gtk.AccessibleBase {
388 var cls *gtk.AccessibleBase
389
390 cret := gtk.XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
391
392 if cret == 0 {
393 return nil
394 }
395 cls = >k.AccessibleBase{}
396 cls.Ptr = cret
397 return cls
398}
399
400// Retrieves the next accessible sibling of an accessible object
401func (x *ViewSwitcherTitle) GetNextAccessibleSibling() *gtk.AccessibleBase {
402 var cls *gtk.AccessibleBase
403
404 cret := gtk.XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
405
406 if cret == 0 {
407 return nil
408 }
409 cls = >k.AccessibleBase{}
410 cls.Ptr = cret
411 return cls
412}
413
414// Queries a platform state, such as focus.
415//
416// This functionality can be overridden by `GtkAccessible`
417// implementations, e.g. to get platform state from an ignored
418// child widget, as is the case for `GtkText` wrappers.
419func (x *ViewSwitcherTitle) GetPlatformState(StateVar gtk.AccessiblePlatformState) bool {
420
421 cret := gtk.XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
422 return cret
423}
424
425// Resets the accessible property to its default value.
426func (x *ViewSwitcherTitle) ResetProperty(PropertyVar gtk.AccessibleProperty) {
427
428 gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
429
430}
431
432// Resets the accessible relation to its default value.
433func (x *ViewSwitcherTitle) ResetRelation(RelationVar gtk.AccessibleRelation) {
434
435 gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
436
437}
438
439// Resets the accessible state to its default value.
440func (x *ViewSwitcherTitle) ResetState(StateVar gtk.AccessibleState) {
441
442 gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar)
443
444}
445
446// Sets the parent and sibling of an accessible object.
447//
448// This function is meant to be used by accessible implementations that are
449// not part of the widget hierarchy, and but act as a logical bridge between
450// widgets. For instance, if a widget creates an object that holds metadata
451// for each child, and you want that object to implement the `GtkAccessible`
452// interface, you will use this function to ensure that the parent of each
453// child widget is the metadata object, and the parent of each metadata
454// object is the container widget.
455func (x *ViewSwitcherTitle) SetAccessibleParent(ParentVar gtk.Accessible, NextSiblingVar gtk.Accessible) {
456
457 gtk.XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
458
459}
460
461// Updates the next accessible sibling.
462//
463// That might be useful when a new child of a custom accessible
464// is created, and it needs to be linked to a previous child.
465func (x *ViewSwitcherTitle) UpdateNextAccessibleSibling(NewSiblingVar gtk.Accessible) {
466
467 gtk.XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
468
469}
470
471// Informs ATs that the platform state has changed.
472//
473// This function should be used by `GtkAccessible` implementations that
474// have a platform state but are not widgets. Widgets handle platform
475// states automatically.
476func (x *ViewSwitcherTitle) UpdatePlatformState(StateVar gtk.AccessiblePlatformState) {
477
478 gtk.XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
479
480}
481
482// Updates a list of accessible properties.
483//
484// See the [enum@Gtk.AccessibleProperty] documentation for the
485// value types of accessible properties.
486//
487// This function should be called by `GtkWidget` types whenever
488// an accessible property change must be communicated to assistive
489// technologies.
490//
491// Example:
492// ```c
493// value = gtk_adjustment_get_value (adjustment);
494// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
495//
496// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
497// -1);
498//
499// ```
500func (x *ViewSwitcherTitle) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) {
501
502 gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
503
504}
505
506// Updates an array of accessible properties.
507//
508// This function should be called by `GtkWidget` types whenever an accessible
509// property change must be communicated to assistive technologies.
510//
511// This function is meant to be used by language bindings.
512func (x *ViewSwitcherTitle) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) {
513
514 gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
515
516}
517
518// Updates a list of accessible relations.
519//
520// This function should be called by `GtkWidget` types whenever an accessible
521// relation change must be communicated to assistive technologies.
522//
523// If the [enum@Gtk.AccessibleRelation] requires a list of references,
524// you should pass each reference individually, followed by `NULL`, e.g.
525//
526// ```c
527// gtk_accessible_update_relation (accessible,
528//
529// GTK_ACCESSIBLE_RELATION_CONTROLS,
530// ref1, NULL,
531// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
532// ref1, ref2, ref3, NULL,
533// -1);
534//
535// ```
536func (x *ViewSwitcherTitle) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) {
537
538 gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
539
540}
541
542// Updates an array of accessible relations.
543//
544// This function should be called by `GtkWidget` types whenever an accessible
545// relation change must be communicated to assistive technologies.
546//
547// This function is meant to be used by language bindings.
548func (x *ViewSwitcherTitle) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) {
549
550 gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
551
552}
553
554// Updates a list of accessible states.
555//
556// See the [enum@Gtk.AccessibleState] documentation for the
557// value types of accessible states.
558//
559// This function should be called by `GtkWidget` types whenever
560// an accessible state change must be communicated to assistive
561// technologies.
562//
563// Example:
564//
565// ```c
566// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
567// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
568//
569// GTK_ACCESSIBLE_STATE_CHECKED, value,
570// -1);
571//
572// ```
573func (x *ViewSwitcherTitle) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) {
574
575 gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
576
577}
578
579// Updates an array of accessible states.
580//
581// This function should be called by `GtkWidget` types whenever an accessible
582// state change must be communicated to assistive technologies.
583//
584// This function is meant to be used by language bindings.
585func (x *ViewSwitcherTitle) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) {
586
587 gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
588
589}
590
591// Gets the ID of the @buildable object.
592//
593// `GtkBuilder` sets the name based on the ID attribute
594// of the `<object>` tag used to construct the @buildable.
595func (x *ViewSwitcherTitle) GetBuildableId() string {
596
597 cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer())
598 return cret
599}
600
601func init() {
602 core.SetPackageName("ADW", "libadwaita-1")
603 core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"})
604 var libs []uintptr
605 for _, libPath := range core.GetPaths("ADW") {
606 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
607 if err != nil {
608 panic(err)
609 }
610 libs = append(libs, lib)
611 }
612
613 core.PuregoSafeRegister(&xViewSwitcherTitleGLibType, libs, "adw_view_switcher_title_get_type")
614
615 core.PuregoSafeRegister(&xNewViewSwitcherTitle, libs, "adw_view_switcher_title_new")
616
617 core.PuregoSafeRegister(&xViewSwitcherTitleGetStack, libs, "adw_view_switcher_title_get_stack")
618 core.PuregoSafeRegister(&xViewSwitcherTitleGetSubtitle, libs, "adw_view_switcher_title_get_subtitle")
619 core.PuregoSafeRegister(&xViewSwitcherTitleGetTitle, libs, "adw_view_switcher_title_get_title")
620 core.PuregoSafeRegister(&xViewSwitcherTitleGetTitleVisible, libs, "adw_view_switcher_title_get_title_visible")
621 core.PuregoSafeRegister(&xViewSwitcherTitleGetViewSwitcherEnabled, libs, "adw_view_switcher_title_get_view_switcher_enabled")
622 core.PuregoSafeRegister(&xViewSwitcherTitleSetStack, libs, "adw_view_switcher_title_set_stack")
623 core.PuregoSafeRegister(&xViewSwitcherTitleSetSubtitle, libs, "adw_view_switcher_title_set_subtitle")
624 core.PuregoSafeRegister(&xViewSwitcherTitleSetTitle, libs, "adw_view_switcher_title_set_title")
625 core.PuregoSafeRegister(&xViewSwitcherTitleSetViewSwitcherEnabled, libs, "adw_view_switcher_title_set_view_switcher_enabled")
626
627}