1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5 "unsafe"
6
7 "github.com/ebitengine/purego"
8
9 "github.com/bnema/puregotk/pkg/core"
10 "github.com/bnema/puregotk/v4/glib"
11 "github.com/bnema/puregotk/v4/gobject"
12 "github.com/bnema/puregotk/v4/gobject/types"
13)
14
15// A `GtkStatusbar` widget is usually placed along the bottom of an application's
16// main [class@Gtk.Window].
17//
18// <picture>
19//
20// <source srcset="statusbar-dark.png" media="(prefers-color-scheme: dark)">
21// <img alt="An example GtkStatusbar" src="statusbar.png">
22//
23// </picture>
24//
25// A `GtkStatusBar` may provide a regular commentary of the application's
26// status (as is usually the case in a web browser, for example), or may be
27// used to simply output a message when the status changes, (when an upload
28// is complete in an FTP client, for example).
29//
30// Status bars in GTK maintain a stack of messages. The message at
31// the top of the each bar’s stack is the one that will currently be displayed.
32//
33// Any messages added to a statusbar’s stack must specify a context id that
34// is used to uniquely identify the source of a message. This context id can
35// be generated by [method@Gtk.Statusbar.get_context_id], given a message and
36// the statusbar that it will be added to. Note that messages are stored in a
37// stack, and when choosing which message to display, the stack structure is
38// adhered to, regardless of the context identifier of a message.
39//
40// One could say that a statusbar maintains one stack of messages for
41// display purposes, but allows multiple message producers to maintain
42// sub-stacks of the messages they produced (via context ids).
43//
44// Status bars are created using [ctor@Gtk.Statusbar.new].
45//
46// Messages are added to the bar’s stack with [method@Gtk.Statusbar.push].
47//
48// The message at the top of the stack can be removed using
49// [method@Gtk.Statusbar.pop]. A message can be removed from anywhere in the
50// stack if its message id was recorded at the time it was added. This is done
51// using [method@Gtk.Statusbar.remove].
52//
53// ## CSS node
54//
55// `GtkStatusbar` has a single CSS node with name `statusbar`.
56type Statusbar struct {
57 Widget
58}
59
60var xStatusbarGLibType func() types.GType
61
62func StatusbarGLibType() types.GType {
63 return xStatusbarGLibType()
64}
65
66func StatusbarNewFromInternalPtr(ptr uintptr) *Statusbar {
67 cls := &Statusbar{}
68 cls.Ptr = ptr
69 return cls
70}
71
72var xNewStatusbar func() uintptr
73
74// Creates a new `GtkStatusbar` ready for messages.
75func NewStatusbar() *Statusbar {
76 var cls *Statusbar
77
78 cret := xNewStatusbar()
79
80 if cret == 0 {
81 return nil
82 }
83 gobject.IncreaseRef(cret)
84 cls = &Statusbar{}
85 cls.Ptr = cret
86 return cls
87}
88
89var xStatusbarGetContextId func(uintptr, string) uint
90
91// Returns a new context identifier, given a description
92// of the actual context.
93//
94// Note that the description is not shown in the UI.
95func (x *Statusbar) GetContextId(ContextDescriptionVar string) uint {
96
97 cret := xStatusbarGetContextId(x.GoPointer(), ContextDescriptionVar)
98 return cret
99}
100
101var xStatusbarPop func(uintptr, uint)
102
103// Removes the first message in the `GtkStatusbar`’s stack
104// with the given context id.
105//
106// Note that this may not change the displayed message,
107// if the message at the top of the stack has a different
108// context id.
109func (x *Statusbar) Pop(ContextIdVar uint) {
110
111 xStatusbarPop(x.GoPointer(), ContextIdVar)
112
113}
114
115var xStatusbarPush func(uintptr, uint, string) uint
116
117// Pushes a new message onto a statusbar’s stack.
118func (x *Statusbar) Push(ContextIdVar uint, TextVar string) uint {
119
120 cret := xStatusbarPush(x.GoPointer(), ContextIdVar, TextVar)
121 return cret
122}
123
124var xStatusbarRemove func(uintptr, uint, uint)
125
126// Forces the removal of a message from a statusbar’s stack.
127// The exact @context_id and @message_id must be specified.
128func (x *Statusbar) Remove(ContextIdVar uint, MessageIdVar uint) {
129
130 xStatusbarRemove(x.GoPointer(), ContextIdVar, MessageIdVar)
131
132}
133
134var xStatusbarRemoveAll func(uintptr, uint)
135
136// Forces the removal of all messages from a statusbar's
137// stack with the exact @context_id.
138func (x *Statusbar) RemoveAll(ContextIdVar uint) {
139
140 xStatusbarRemoveAll(x.GoPointer(), ContextIdVar)
141
142}
143
144func (c *Statusbar) GoPointer() uintptr {
145 if c == nil {
146 return 0
147 }
148 return c.Ptr
149}
150
151func (c *Statusbar) SetGoPointer(ptr uintptr) {
152 c.Ptr = ptr
153}
154
155// Emitted whenever a new message is popped off a statusbar's stack.
156func (x *Statusbar) ConnectTextPopped(cb *func(Statusbar, uint, string)) uint {
157 cbPtr := uintptr(unsafe.Pointer(cb))
158 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
159 handlerID := gobject.SignalConnect(x.GoPointer(), "text-popped", cbRefPtr)
160 glib.SaveHandlerMapping(handlerID, cbPtr)
161 return handlerID
162 }
163
164 fcb := func(clsPtr uintptr, ContextIdVarp uint, TextVarp uintptr) {
165 fa := Statusbar{}
166 fa.Ptr = clsPtr
167 cbFn := *cb
168
169 cbFn(fa, ContextIdVarp, core.GoString(TextVarp))
170
171 }
172 cbRefPtr := purego.NewCallback(fcb)
173 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
174 handlerID := gobject.SignalConnect(x.GoPointer(), "text-popped", cbRefPtr)
175 glib.SaveHandlerMapping(handlerID, cbPtr)
176 return handlerID
177}
178
179// Emitted whenever a new message gets pushed onto a statusbar's stack.
180func (x *Statusbar) ConnectTextPushed(cb *func(Statusbar, uint, string)) uint {
181 cbPtr := uintptr(unsafe.Pointer(cb))
182 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
183 handlerID := gobject.SignalConnect(x.GoPointer(), "text-pushed", cbRefPtr)
184 glib.SaveHandlerMapping(handlerID, cbPtr)
185 return handlerID
186 }
187
188 fcb := func(clsPtr uintptr, ContextIdVarp uint, TextVarp uintptr) {
189 fa := Statusbar{}
190 fa.Ptr = clsPtr
191 cbFn := *cb
192
193 cbFn(fa, ContextIdVarp, core.GoString(TextVarp))
194
195 }
196 cbRefPtr := purego.NewCallback(fcb)
197 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
198 handlerID := gobject.SignalConnect(x.GoPointer(), "text-pushed", cbRefPtr)
199 glib.SaveHandlerMapping(handlerID, cbPtr)
200 return handlerID
201}
202
203// Requests the user's screen reader to announce the given message.
204//
205// This kind of notification is useful for messages that
206// either have only a visual representation or that are not
207// exposed visually at all, e.g. a notification about a
208// successful operation.
209//
210// Also, by using this API, you can ensure that the message
211// does not interrupts the user's current screen reader output.
212func (x *Statusbar) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
213
214 XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
215
216}
217
218// Retrieves the accessible parent for an accessible object.
219//
220// This function returns `NULL` for top level widgets.
221func (x *Statusbar) GetAccessibleParent() *AccessibleBase {
222 var cls *AccessibleBase
223
224 cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
225
226 if cret == 0 {
227 return nil
228 }
229 cls = &AccessibleBase{}
230 cls.Ptr = cret
231 return cls
232}
233
234// Retrieves the accessible role of an accessible object.
235func (x *Statusbar) GetAccessibleRole() AccessibleRole {
236
237 cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
238 return cret
239}
240
241// Retrieves the implementation for the given accessible object.
242func (x *Statusbar) GetAtContext() *ATContext {
243 var cls *ATContext
244
245 cret := XGtkAccessibleGetAtContext(x.GoPointer())
246
247 if cret == 0 {
248 return nil
249 }
250 cls = &ATContext{}
251 cls.Ptr = cret
252 return cls
253}
254
255// Queries the coordinates and dimensions of this accessible
256//
257// This functionality can be overridden by `GtkAccessible`
258// implementations, e.g. to get the bounds from an ignored
259// child widget.
260func (x *Statusbar) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
261
262 cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
263 return cret
264}
265
266// Retrieves the first accessible child of an accessible object.
267func (x *Statusbar) GetFirstAccessibleChild() *AccessibleBase {
268 var cls *AccessibleBase
269
270 cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
271
272 if cret == 0 {
273 return nil
274 }
275 cls = &AccessibleBase{}
276 cls.Ptr = cret
277 return cls
278}
279
280// Retrieves the next accessible sibling of an accessible object
281func (x *Statusbar) GetNextAccessibleSibling() *AccessibleBase {
282 var cls *AccessibleBase
283
284 cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
285
286 if cret == 0 {
287 return nil
288 }
289 cls = &AccessibleBase{}
290 cls.Ptr = cret
291 return cls
292}
293
294// Queries a platform state, such as focus.
295//
296// This functionality can be overridden by `GtkAccessible`
297// implementations, e.g. to get platform state from an ignored
298// child widget, as is the case for `GtkText` wrappers.
299func (x *Statusbar) GetPlatformState(StateVar AccessiblePlatformState) bool {
300
301 cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
302 return cret
303}
304
305// Resets the accessible property to its default value.
306func (x *Statusbar) ResetProperty(PropertyVar AccessibleProperty) {
307
308 XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
309
310}
311
312// Resets the accessible relation to its default value.
313func (x *Statusbar) ResetRelation(RelationVar AccessibleRelation) {
314
315 XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
316
317}
318
319// Resets the accessible state to its default value.
320func (x *Statusbar) ResetState(StateVar AccessibleState) {
321
322 XGtkAccessibleResetState(x.GoPointer(), StateVar)
323
324}
325
326// Sets the parent and sibling of an accessible object.
327//
328// This function is meant to be used by accessible implementations that are
329// not part of the widget hierarchy, and but act as a logical bridge between
330// widgets. For instance, if a widget creates an object that holds metadata
331// for each child, and you want that object to implement the `GtkAccessible`
332// interface, you will use this function to ensure that the parent of each
333// child widget is the metadata object, and the parent of each metadata
334// object is the container widget.
335func (x *Statusbar) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
336
337 XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
338
339}
340
341// Updates the next accessible sibling.
342//
343// That might be useful when a new child of a custom accessible
344// is created, and it needs to be linked to a previous child.
345func (x *Statusbar) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
346
347 XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
348
349}
350
351// Informs ATs that the platform state has changed.
352//
353// This function should be used by `GtkAccessible` implementations that
354// have a platform state but are not widgets. Widgets handle platform
355// states automatically.
356func (x *Statusbar) UpdatePlatformState(StateVar AccessiblePlatformState) {
357
358 XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
359
360}
361
362// Updates a list of accessible properties.
363//
364// See the [enum@Gtk.AccessibleProperty] documentation for the
365// value types of accessible properties.
366//
367// This function should be called by `GtkWidget` types whenever
368// an accessible property change must be communicated to assistive
369// technologies.
370//
371// Example:
372// ```c
373// value = gtk_adjustment_get_value (adjustment);
374// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
375//
376// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
377// -1);
378//
379// ```
380func (x *Statusbar) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
381
382 XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
383
384}
385
386// Updates an array of accessible properties.
387//
388// This function should be called by `GtkWidget` types whenever an accessible
389// property change must be communicated to assistive technologies.
390//
391// This function is meant to be used by language bindings.
392func (x *Statusbar) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
393
394 XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
395
396}
397
398// Updates a list of accessible relations.
399//
400// This function should be called by `GtkWidget` types whenever an accessible
401// relation change must be communicated to assistive technologies.
402//
403// If the [enum@Gtk.AccessibleRelation] requires a list of references,
404// you should pass each reference individually, followed by `NULL`, e.g.
405//
406// ```c
407// gtk_accessible_update_relation (accessible,
408//
409// GTK_ACCESSIBLE_RELATION_CONTROLS,
410// ref1, NULL,
411// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
412// ref1, ref2, ref3, NULL,
413// -1);
414//
415// ```
416func (x *Statusbar) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
417
418 XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
419
420}
421
422// Updates an array of accessible relations.
423//
424// This function should be called by `GtkWidget` types whenever an accessible
425// relation change must be communicated to assistive technologies.
426//
427// This function is meant to be used by language bindings.
428func (x *Statusbar) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
429
430 XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
431
432}
433
434// Updates a list of accessible states.
435//
436// See the [enum@Gtk.AccessibleState] documentation for the
437// value types of accessible states.
438//
439// This function should be called by `GtkWidget` types whenever
440// an accessible state change must be communicated to assistive
441// technologies.
442//
443// Example:
444//
445// ```c
446// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
447// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
448//
449// GTK_ACCESSIBLE_STATE_CHECKED, value,
450// -1);
451//
452// ```
453func (x *Statusbar) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
454
455 XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
456
457}
458
459// Updates an array of accessible states.
460//
461// This function should be called by `GtkWidget` types whenever an accessible
462// state change must be communicated to assistive technologies.
463//
464// This function is meant to be used by language bindings.
465func (x *Statusbar) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
466
467 XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
468
469}
470
471// Gets the ID of the @buildable object.
472//
473// `GtkBuilder` sets the name based on the ID attribute
474// of the `<object>` tag used to construct the @buildable.
475func (x *Statusbar) GetBuildableId() string {
476
477 cret := XGtkBuildableGetBuildableId(x.GoPointer())
478 return cret
479}
480
481func init() {
482 core.SetPackageName("GTK", "gtk4")
483 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
484 var libs []uintptr
485 for _, libPath := range core.GetPaths("GTK") {
486 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
487 if err != nil {
488 panic(err)
489 }
490 libs = append(libs, lib)
491 }
492
493 core.PuregoSafeRegister(&xStatusbarGLibType, libs, "gtk_statusbar_get_type")
494
495 core.PuregoSafeRegister(&xNewStatusbar, libs, "gtk_statusbar_new")
496
497 core.PuregoSafeRegister(&xStatusbarGetContextId, libs, "gtk_statusbar_get_context_id")
498 core.PuregoSafeRegister(&xStatusbarPop, libs, "gtk_statusbar_pop")
499 core.PuregoSafeRegister(&xStatusbarPush, libs, "gtk_statusbar_push")
500 core.PuregoSafeRegister(&xStatusbarRemove, libs, "gtk_statusbar_remove")
501 core.PuregoSafeRegister(&xStatusbarRemoveAll, libs, "gtk_statusbar_remove_all")
502
503}