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 SwitchRowClass struct {
18 _ structs.HostLayout
19
20 ParentClass ActionRowClass
21}
22
23func (x *SwitchRowClass) GoPointer() uintptr {
24 return uintptr(unsafe.Pointer(x))
25}
26
27// A [class@Gtk.ListBoxRow] used to represent two states.
28//
29// <picture>
30//
31// <source srcset="switch-row-dark.png" media="(prefers-color-scheme: dark)">
32// <img src="switch-row.png" alt="switch-row">
33//
34// </picture>
35//
36// The `AdwSwitchRow` widget contains a [class@Gtk.Switch] that allows the user
37// to select between two states: "on" or "off". When activated, the row will
38// invert its active state.
39//
40// The user can control the switch by activating the row or by dragging on the
41// switch handle.
42//
43// See [class@Gtk.Switch] for details.
44//
45// Example of an `AdwSwitchRow` UI definition:
46// ```xml
47// <object class="AdwSwitchRow">
48//
49// <property name="title" translatable="yes">Switch Row</property>
50// <signal name="notify::active" handler="switch_row_notify_active_cb"/>
51//
52// </object>
53// ```
54//
55// The [property@SwitchRow:active] property should be connected to in order to
56// monitor changes to the active state.
57//
58// ## Accessibility
59//
60// `AdwSwitchRow` uses the `GTK_ACCESSIBLE_ROLE_SWITCH` role.
61type SwitchRow struct {
62 ActionRow
63}
64
65var xSwitchRowGLibType func() types.GType
66
67func SwitchRowGLibType() types.GType {
68 return xSwitchRowGLibType()
69}
70
71func SwitchRowNewFromInternalPtr(ptr uintptr) *SwitchRow {
72 cls := &SwitchRow{}
73 cls.Ptr = ptr
74 return cls
75}
76
77var xNewSwitchRow func() uintptr
78
79// Creates a new `AdwSwitchRow`.
80func NewSwitchRow() *SwitchRow {
81 var cls *SwitchRow
82
83 cret := xNewSwitchRow()
84
85 if cret == 0 {
86 return nil
87 }
88 gobject.IncreaseRef(cret)
89 cls = &SwitchRow{}
90 cls.Ptr = cret
91 return cls
92}
93
94var xSwitchRowGetActive func(uintptr) bool
95
96// Gets whether @self is in its "on" or "off" position.
97func (x *SwitchRow) GetActive() bool {
98
99 cret := xSwitchRowGetActive(x.GoPointer())
100 return cret
101}
102
103var xSwitchRowSetActive func(uintptr, bool)
104
105// Sets whether @self is in its "on" or "off" position
106func (x *SwitchRow) SetActive(IsActiveVar bool) {
107
108 xSwitchRowSetActive(x.GoPointer(), IsActiveVar)
109
110}
111
112func (c *SwitchRow) GoPointer() uintptr {
113 if c == nil {
114 return 0
115 }
116 return c.Ptr
117}
118
119func (c *SwitchRow) SetGoPointer(ptr uintptr) {
120 c.Ptr = ptr
121}
122
123// SetPropertyActive sets the "active" property.
124// Whether the switch row is in the "on" or "off" position.
125func (x *SwitchRow) SetPropertyActive(value bool) {
126 var v gobject.Value
127 v.Init(gobject.TypeBooleanVal)
128 v.SetBoolean(value)
129 x.SetProperty("active", &v)
130}
131
132// GetPropertyActive gets the "active" property.
133// Whether the switch row is in the "on" or "off" position.
134func (x *SwitchRow) GetPropertyActive() bool {
135 var v gobject.Value
136 x.GetProperty("active", &v)
137 return v.GetBoolean()
138}
139
140// Requests the user's screen reader to announce the given message.
141//
142// This kind of notification is useful for messages that
143// either have only a visual representation or that are not
144// exposed visually at all, e.g. a notification about a
145// successful operation.
146//
147// Also, by using this API, you can ensure that the message
148// does not interrupts the user's current screen reader output.
149func (x *SwitchRow) Announce(MessageVar string, PriorityVar gtk.AccessibleAnnouncementPriority) {
150
151 gtk.XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
152
153}
154
155// Retrieves the accessible parent for an accessible object.
156//
157// This function returns `NULL` for top level widgets.
158func (x *SwitchRow) GetAccessibleParent() *gtk.AccessibleBase {
159 var cls *gtk.AccessibleBase
160
161 cret := gtk.XGtkAccessibleGetAccessibleParent(x.GoPointer())
162
163 if cret == 0 {
164 return nil
165 }
166 cls = >k.AccessibleBase{}
167 cls.Ptr = cret
168 return cls
169}
170
171// Retrieves the accessible role of an accessible object.
172func (x *SwitchRow) GetAccessibleRole() gtk.AccessibleRole {
173
174 cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer())
175 return cret
176}
177
178// Retrieves the implementation for the given accessible object.
179func (x *SwitchRow) GetAtContext() *gtk.ATContext {
180 var cls *gtk.ATContext
181
182 cret := gtk.XGtkAccessibleGetAtContext(x.GoPointer())
183
184 if cret == 0 {
185 return nil
186 }
187 cls = >k.ATContext{}
188 cls.Ptr = cret
189 return cls
190}
191
192// Queries the coordinates and dimensions of this accessible
193//
194// This functionality can be overridden by `GtkAccessible`
195// implementations, e.g. to get the bounds from an ignored
196// child widget.
197func (x *SwitchRow) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
198
199 cret := gtk.XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
200 return cret
201}
202
203// Retrieves the first accessible child of an accessible object.
204func (x *SwitchRow) GetFirstAccessibleChild() *gtk.AccessibleBase {
205 var cls *gtk.AccessibleBase
206
207 cret := gtk.XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
208
209 if cret == 0 {
210 return nil
211 }
212 cls = >k.AccessibleBase{}
213 cls.Ptr = cret
214 return cls
215}
216
217// Retrieves the next accessible sibling of an accessible object
218func (x *SwitchRow) GetNextAccessibleSibling() *gtk.AccessibleBase {
219 var cls *gtk.AccessibleBase
220
221 cret := gtk.XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
222
223 if cret == 0 {
224 return nil
225 }
226 cls = >k.AccessibleBase{}
227 cls.Ptr = cret
228 return cls
229}
230
231// Queries a platform state, such as focus.
232//
233// This functionality can be overridden by `GtkAccessible`
234// implementations, e.g. to get platform state from an ignored
235// child widget, as is the case for `GtkText` wrappers.
236func (x *SwitchRow) GetPlatformState(StateVar gtk.AccessiblePlatformState) bool {
237
238 cret := gtk.XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
239 return cret
240}
241
242// Resets the accessible property to its default value.
243func (x *SwitchRow) ResetProperty(PropertyVar gtk.AccessibleProperty) {
244
245 gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
246
247}
248
249// Resets the accessible relation to its default value.
250func (x *SwitchRow) ResetRelation(RelationVar gtk.AccessibleRelation) {
251
252 gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
253
254}
255
256// Resets the accessible state to its default value.
257func (x *SwitchRow) ResetState(StateVar gtk.AccessibleState) {
258
259 gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar)
260
261}
262
263// Sets the parent and sibling of an accessible object.
264//
265// This function is meant to be used by accessible implementations that are
266// not part of the widget hierarchy, and but act as a logical bridge between
267// widgets. For instance, if a widget creates an object that holds metadata
268// for each child, and you want that object to implement the `GtkAccessible`
269// interface, you will use this function to ensure that the parent of each
270// child widget is the metadata object, and the parent of each metadata
271// object is the container widget.
272func (x *SwitchRow) SetAccessibleParent(ParentVar gtk.Accessible, NextSiblingVar gtk.Accessible) {
273
274 gtk.XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
275
276}
277
278// Updates the next accessible sibling.
279//
280// That might be useful when a new child of a custom accessible
281// is created, and it needs to be linked to a previous child.
282func (x *SwitchRow) UpdateNextAccessibleSibling(NewSiblingVar gtk.Accessible) {
283
284 gtk.XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
285
286}
287
288// Informs ATs that the platform state has changed.
289//
290// This function should be used by `GtkAccessible` implementations that
291// have a platform state but are not widgets. Widgets handle platform
292// states automatically.
293func (x *SwitchRow) UpdatePlatformState(StateVar gtk.AccessiblePlatformState) {
294
295 gtk.XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
296
297}
298
299// Updates a list of accessible properties.
300//
301// See the [enum@Gtk.AccessibleProperty] documentation for the
302// value types of accessible properties.
303//
304// This function should be called by `GtkWidget` types whenever
305// an accessible property change must be communicated to assistive
306// technologies.
307//
308// Example:
309// ```c
310// value = gtk_adjustment_get_value (adjustment);
311// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
312//
313// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
314// -1);
315//
316// ```
317func (x *SwitchRow) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) {
318
319 gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
320
321}
322
323// Updates an array of accessible properties.
324//
325// This function should be called by `GtkWidget` types whenever an accessible
326// property change must be communicated to assistive technologies.
327//
328// This function is meant to be used by language bindings.
329func (x *SwitchRow) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) {
330
331 gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
332
333}
334
335// Updates a list of accessible relations.
336//
337// This function should be called by `GtkWidget` types whenever an accessible
338// relation change must be communicated to assistive technologies.
339//
340// If the [enum@Gtk.AccessibleRelation] requires a list of references,
341// you should pass each reference individually, followed by `NULL`, e.g.
342//
343// ```c
344// gtk_accessible_update_relation (accessible,
345//
346// GTK_ACCESSIBLE_RELATION_CONTROLS,
347// ref1, NULL,
348// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
349// ref1, ref2, ref3, NULL,
350// -1);
351//
352// ```
353func (x *SwitchRow) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) {
354
355 gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
356
357}
358
359// Updates an array of accessible relations.
360//
361// This function should be called by `GtkWidget` types whenever an accessible
362// relation change must be communicated to assistive technologies.
363//
364// This function is meant to be used by language bindings.
365func (x *SwitchRow) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) {
366
367 gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
368
369}
370
371// Updates a list of accessible states.
372//
373// See the [enum@Gtk.AccessibleState] documentation for the
374// value types of accessible states.
375//
376// This function should be called by `GtkWidget` types whenever
377// an accessible state change must be communicated to assistive
378// technologies.
379//
380// Example:
381//
382// ```c
383// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
384// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
385//
386// GTK_ACCESSIBLE_STATE_CHECKED, value,
387// -1);
388//
389// ```
390func (x *SwitchRow) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) {
391
392 gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
393
394}
395
396// Updates an array of accessible states.
397//
398// This function should be called by `GtkWidget` types whenever an accessible
399// state change must be communicated to assistive technologies.
400//
401// This function is meant to be used by language bindings.
402func (x *SwitchRow) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) {
403
404 gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
405
406}
407
408// Gets the action name for @actionable.
409func (x *SwitchRow) GetActionName() string {
410
411 cret := gtk.XGtkActionableGetActionName(x.GoPointer())
412 return cret
413}
414
415// Gets the current target value of @actionable.
416func (x *SwitchRow) GetActionTargetValue() *glib.Variant {
417
418 cret := gtk.XGtkActionableGetActionTargetValue(x.GoPointer())
419 return cret
420}
421
422// Specifies the name of the action with which this widget should be
423// associated.
424//
425// If @action_name is %NULL then the widget will be unassociated from
426// any previous action.
427//
428// Usually this function is used when the widget is located (or will be
429// located) within the hierarchy of a `GtkApplicationWindow`.
430//
431// Names are of the form “win.save” or “app.quit” for actions on the
432// containing [class@ApplicationWindow] or its associated [class@Application],
433// respectively. This is the same form used for actions in the [class@Gio.Menu]
434// associated with the window.
435func (x *SwitchRow) SetActionName(ActionNameVar *string) {
436
437 ActionNameVarPtr := core.GStrdupNullable(ActionNameVar)
438 defer core.GFreeNullable(ActionNameVarPtr)
439
440 gtk.XGtkActionableSetActionName(x.GoPointer(), ActionNameVarPtr)
441
442}
443
444// Sets the target of an actionable widget.
445//
446// This is a convenience function that calls [ctor@GLib.Variant.new] for
447// @format_string and uses the result to call
448// [method@Gtk.Actionable.set_action_target_value].
449//
450// If you are setting a string-valued target and want to set
451// the action name at the same time, you can use
452// [method@Gtk.Actionable.set_detailed_action_name].
453func (x *SwitchRow) SetActionTarget(FormatStringVar string, varArgs ...interface{}) {
454
455 gtk.XGtkActionableSetActionTarget(x.GoPointer(), FormatStringVar, varArgs...)
456
457}
458
459// Sets the target value of an actionable widget.
460//
461// If @target_value is %NULL then the target value is unset.
462//
463// The target value has two purposes. First, it is used as the parameter
464// to activation of the action associated with the `GtkActionable` widget.
465// Second, it is used to determine if the widget should be rendered as
466// “active” — the widget is active if the state is equal to the given target.
467//
468// Consider the example of associating a set of buttons with a [iface@Gio.Action]
469// with string state in a typical “radio button” situation. Each button
470// will be associated with the same action, but with a different target
471// value for that action. Clicking on a particular button will activate
472// the action with the target of that button, which will typically cause
473// the action’s state to change to that value. Since the action’s state
474// is now equal to the target value of the button, the button will now
475// be rendered as active (and the other buttons, with different targets,
476// rendered inactive).
477func (x *SwitchRow) SetActionTargetValue(TargetValueVar *glib.Variant) {
478
479 gtk.XGtkActionableSetActionTargetValue(x.GoPointer(), TargetValueVar)
480
481}
482
483// Sets the action-name and associated string target value of an
484// actionable widget.
485//
486// @detailed_action_name is a string in the format accepted by
487// [func@Gio.Action.parse_detailed_name].
488func (x *SwitchRow) SetDetailedActionName(DetailedActionNameVar string) {
489
490 gtk.XGtkActionableSetDetailedActionName(x.GoPointer(), DetailedActionNameVar)
491
492}
493
494// Gets the ID of the @buildable object.
495//
496// `GtkBuilder` sets the name based on the ID attribute
497// of the `<object>` tag used to construct the @buildable.
498func (x *SwitchRow) GetBuildableId() string {
499
500 cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer())
501 return cret
502}
503
504func init() {
505 core.SetPackageName("ADW", "libadwaita-1")
506 core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"})
507 var libs []uintptr
508 for _, libPath := range core.GetPaths("ADW") {
509 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
510 if err != nil {
511 panic(err)
512 }
513 libs = append(libs, lib)
514 }
515
516 core.PuregoSafeRegister(&xSwitchRowGLibType, libs, "adw_switch_row_get_type")
517
518 core.PuregoSafeRegister(&xNewSwitchRow, libs, "adw_switch_row_new")
519
520 core.PuregoSafeRegister(&xSwitchRowGetActive, libs, "adw_switch_row_get_active")
521 core.PuregoSafeRegister(&xSwitchRowSetActive, libs, "adw_switch_row_set_active")
522
523}