v0.2.1 c0399be

gtkwindowcontrols.go RawHistoryFolder

1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
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)
14
15type WindowControlsClass struct {
16	_ structs.HostLayout
17
18	ParentClass WidgetClass
19}
20
21func (x *WindowControlsClass) GoPointer() uintptr {
22	return uintptr(unsafe.Pointer(x))
23}
24
25// Shows window frame controls.
26//
27// Typical window frame controls are minimize, maximize and close buttons,
28// and the window icon.
29//
30// <picture>
31//
32//	<source srcset="windowcontrols-dark.png" media="(prefers-color-scheme: dark)">
33//	<img alt="An example GtkWindowControls" src="windowcontrols.png">
34//
35// </picture>
36//
37// `GtkWindowControls` only displays start or end side of the controls (see
38// [property@Gtk.WindowControls:side]), so it's intended to be always used
39// in pair with another `GtkWindowControls` for the opposite side, for example:
40//
41// ```xml
42// <object class="GtkBox">
43//
44//	<child>
45//	  <object class="GtkWindowControls">
46//	    <property name="side">start</property>
47//	  </object>
48//	</child>
49//
50//	...
51//
52//	<child>
53//	  <object class="GtkWindowControls">
54//	    <property name="side">end</property>
55//	  </object>
56//	</child>
57//
58// </object>
59// ```
60//
61// # CSS nodes
62//
63// ```
64// windowcontrols
65// ├── [image.icon]
66// ├── [button.minimize]
67// ├── [button.maximize]
68// ╰── [button.close]
69// ```
70//
71// A `GtkWindowControls`' CSS node is called windowcontrols. It contains
72// subnodes corresponding to each title button. Which of the title buttons
73// exist and where they are placed exactly depends on the desktop environment
74// and [property@Gtk.WindowControls:decoration-layout] value.
75//
76// When [property@Gtk.WindowControls:empty] is true, it gets the .empty
77// style class.
78//
79// # Accessibility
80//
81// `GtkWindowControls` uses the [enum@Gtk.AccessibleRole.group] role.
82type WindowControls struct {
83	Widget
84}
85
86var xWindowControlsGLibType func() types.GType
87
88func WindowControlsGLibType() types.GType {
89	return xWindowControlsGLibType()
90}
91
92func WindowControlsNewFromInternalPtr(ptr uintptr) *WindowControls {
93	cls := &WindowControls{}
94	cls.Ptr = ptr
95	return cls
96}
97
98var xNewWindowControls func(PackType) uintptr
99
100// Creates a new `GtkWindowControls`.
101func NewWindowControls(SideVar PackType) *WindowControls {
102	var cls *WindowControls
103
104	cret := xNewWindowControls(SideVar)
105
106	if cret == 0 {
107		return nil
108	}
109	gobject.IncreaseRef(cret)
110	cls = &WindowControls{}
111	cls.Ptr = cret
112	return cls
113}
114
115var xWindowControlsGetDecorationLayout func(uintptr) string
116
117// Gets the decoration layout of this window controls widget
118func (x *WindowControls) GetDecorationLayout() string {
119
120	cret := xWindowControlsGetDecorationLayout(x.GoPointer())
121	return cret
122}
123
124var xWindowControlsGetEmpty func(uintptr) bool
125
126// Gets whether the widget has any window buttons.
127func (x *WindowControls) GetEmpty() bool {
128
129	cret := xWindowControlsGetEmpty(x.GoPointer())
130	return cret
131}
132
133var xWindowControlsGetSide func(uintptr) PackType
134
135// Gets the side to which this window controls widget belongs.
136func (x *WindowControls) GetSide() PackType {
137
138	cret := xWindowControlsGetSide(x.GoPointer())
139	return cret
140}
141
142var xWindowControlsGetUseNativeControls func(uintptr) bool
143
144// Returns whether platform native window controls are shown.
145func (x *WindowControls) GetUseNativeControls() bool {
146
147	cret := xWindowControlsGetUseNativeControls(x.GoPointer())
148	return cret
149}
150
151var xWindowControlsSetDecorationLayout func(uintptr, uintptr)
152
153// Sets the decoration layout for the title buttons.
154//
155// This overrides the [property@Gtk.Settings:gtk-decoration-layout]
156// setting.
157//
158// The format of the string is button names, separated by commas.
159// A colon separates the buttons that should appear on the left
160// from those on the right. Recognized button names are minimize,
161// maximize, close and icon (the window icon).
162//
163// For example, “icon:minimize,maximize,close” specifies a icon
164// on the left, and minimize, maximize and close buttons on the right.
165//
166// If [property@Gtk.WindowControls:side] value is [enum@Gtk.PackType.start],
167// @self will display the part before the colon, otherwise after that.
168func (x *WindowControls) SetDecorationLayout(LayoutVar *string) {
169
170	LayoutVarPtr := core.GStrdupNullable(LayoutVar)
171	defer core.GFreeNullable(LayoutVarPtr)
172
173	xWindowControlsSetDecorationLayout(x.GoPointer(), LayoutVarPtr)
174
175}
176
177var xWindowControlsSetSide func(uintptr, PackType)
178
179// Determines which part of decoration layout
180// the window controls widget uses.
181//
182// See [property@Gtk.WindowControls:decoration-layout].
183func (x *WindowControls) SetSide(SideVar PackType) {
184
185	xWindowControlsSetSide(x.GoPointer(), SideVar)
186
187}
188
189var xWindowControlsSetUseNativeControls func(uintptr, bool)
190
191// Sets whether platform native window controls are used.
192//
193// This option shows the "stoplight" buttons on macOS.
194// For Linux, this option has no effect.
195//
196// See also [Using GTK on Apple macOS](osx.html?native-window-controls).
197func (x *WindowControls) SetUseNativeControls(SettingVar bool) {
198
199	xWindowControlsSetUseNativeControls(x.GoPointer(), SettingVar)
200
201}
202
203func (c *WindowControls) GoPointer() uintptr {
204	if c == nil {
205		return 0
206	}
207	return c.Ptr
208}
209
210func (c *WindowControls) SetGoPointer(ptr uintptr) {
211	c.Ptr = ptr
212}
213
214// SetPropertyDecorationLayout sets the "decoration-layout" property.
215// The decoration layout for window buttons.
216//
217// If this property is not set, the
218// [property@Gtk.Settings:gtk-decoration-layout] setting is used.
219func (x *WindowControls) SetPropertyDecorationLayout(value string) {
220	var v gobject.Value
221	v.Init(gobject.TypeStringVal)
222	v.SetString(&value)
223	x.SetProperty("decoration-layout", &v)
224}
225
226// GetPropertyDecorationLayout gets the "decoration-layout" property.
227// The decoration layout for window buttons.
228//
229// If this property is not set, the
230// [property@Gtk.Settings:gtk-decoration-layout] setting is used.
231func (x *WindowControls) GetPropertyDecorationLayout() string {
232	var v gobject.Value
233	x.GetProperty("decoration-layout", &v)
234	return v.GetString()
235}
236
237// GetPropertyEmpty gets the "empty" property.
238// Whether the widget has any window buttons.
239func (x *WindowControls) GetPropertyEmpty() bool {
240	var v gobject.Value
241	x.GetProperty("empty", &v)
242	return v.GetBoolean()
243}
244
245// SetPropertyUseNativeControls sets the "use-native-controls" property.
246// Whether to show platform native close/minimize/maximize buttons.
247//
248// For macOS, the [property@Gtk.HeaderBar:decoration-layout] property
249// controls the use of native window controls.
250//
251// On other platforms, this option has no effect.
252//
253// See also [Using GTK on Apple macOS](osx.html?native-window-controls).
254func (x *WindowControls) SetPropertyUseNativeControls(value bool) {
255	var v gobject.Value
256	v.Init(gobject.TypeBooleanVal)
257	v.SetBoolean(value)
258	x.SetProperty("use-native-controls", &v)
259}
260
261// GetPropertyUseNativeControls gets the "use-native-controls" property.
262// Whether to show platform native close/minimize/maximize buttons.
263//
264// For macOS, the [property@Gtk.HeaderBar:decoration-layout] property
265// controls the use of native window controls.
266//
267// On other platforms, this option has no effect.
268//
269// See also [Using GTK on Apple macOS](osx.html?native-window-controls).
270func (x *WindowControls) GetPropertyUseNativeControls() bool {
271	var v gobject.Value
272	x.GetProperty("use-native-controls", &v)
273	return v.GetBoolean()
274}
275
276// Requests the user's screen reader to announce the given message.
277//
278// This kind of notification is useful for messages that
279// either have only a visual representation or that are not
280// exposed visually at all, e.g. a notification about a
281// successful operation.
282//
283// Also, by using this API, you can ensure that the message
284// does not interrupts the user's current screen reader output.
285func (x *WindowControls) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
286
287	XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
288
289}
290
291// Retrieves the accessible parent for an accessible object.
292//
293// This function returns `NULL` for top level widgets.
294func (x *WindowControls) GetAccessibleParent() *AccessibleBase {
295	var cls *AccessibleBase
296
297	cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
298
299	if cret == 0 {
300		return nil
301	}
302	cls = &AccessibleBase{}
303	cls.Ptr = cret
304	return cls
305}
306
307// Retrieves the accessible role of an accessible object.
308func (x *WindowControls) GetAccessibleRole() AccessibleRole {
309
310	cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
311	return cret
312}
313
314// Retrieves the implementation for the given accessible object.
315func (x *WindowControls) GetAtContext() *ATContext {
316	var cls *ATContext
317
318	cret := XGtkAccessibleGetAtContext(x.GoPointer())
319
320	if cret == 0 {
321		return nil
322	}
323	cls = &ATContext{}
324	cls.Ptr = cret
325	return cls
326}
327
328// Queries the coordinates and dimensions of this accessible
329//
330// This functionality can be overridden by `GtkAccessible`
331// implementations, e.g. to get the bounds from an ignored
332// child widget.
333func (x *WindowControls) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
334
335	cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
336	return cret
337}
338
339// Retrieves the first accessible child of an accessible object.
340func (x *WindowControls) GetFirstAccessibleChild() *AccessibleBase {
341	var cls *AccessibleBase
342
343	cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
344
345	if cret == 0 {
346		return nil
347	}
348	cls = &AccessibleBase{}
349	cls.Ptr = cret
350	return cls
351}
352
353// Retrieves the next accessible sibling of an accessible object
354func (x *WindowControls) GetNextAccessibleSibling() *AccessibleBase {
355	var cls *AccessibleBase
356
357	cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
358
359	if cret == 0 {
360		return nil
361	}
362	cls = &AccessibleBase{}
363	cls.Ptr = cret
364	return cls
365}
366
367// Queries a platform state, such as focus.
368//
369// This functionality can be overridden by `GtkAccessible`
370// implementations, e.g. to get platform state from an ignored
371// child widget, as is the case for `GtkText` wrappers.
372func (x *WindowControls) GetPlatformState(StateVar AccessiblePlatformState) bool {
373
374	cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
375	return cret
376}
377
378// Resets the accessible property to its default value.
379func (x *WindowControls) ResetProperty(PropertyVar AccessibleProperty) {
380
381	XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
382
383}
384
385// Resets the accessible relation to its default value.
386func (x *WindowControls) ResetRelation(RelationVar AccessibleRelation) {
387
388	XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
389
390}
391
392// Resets the accessible state to its default value.
393func (x *WindowControls) ResetState(StateVar AccessibleState) {
394
395	XGtkAccessibleResetState(x.GoPointer(), StateVar)
396
397}
398
399// Sets the parent and sibling of an accessible object.
400//
401// This function is meant to be used by accessible implementations that are
402// not part of the widget hierarchy, and but act as a logical bridge between
403// widgets. For instance, if a widget creates an object that holds metadata
404// for each child, and you want that object to implement the `GtkAccessible`
405// interface, you will use this function to ensure that the parent of each
406// child widget is the metadata object, and the parent of each metadata
407// object is the container widget.
408func (x *WindowControls) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
409
410	XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
411
412}
413
414// Updates the next accessible sibling.
415//
416// That might be useful when a new child of a custom accessible
417// is created, and it needs to be linked to a previous child.
418func (x *WindowControls) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
419
420	XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
421
422}
423
424// Informs ATs that the platform state has changed.
425//
426// This function should be used by `GtkAccessible` implementations that
427// have a platform state but are not widgets. Widgets handle platform
428// states automatically.
429func (x *WindowControls) UpdatePlatformState(StateVar AccessiblePlatformState) {
430
431	XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
432
433}
434
435// Updates a list of accessible properties.
436//
437// See the [enum@Gtk.AccessibleProperty] documentation for the
438// value types of accessible properties.
439//
440// This function should be called by `GtkWidget` types whenever
441// an accessible property change must be communicated to assistive
442// technologies.
443//
444// Example:
445// ```c
446// value = gtk_adjustment_get_value (adjustment);
447// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
448//
449//	GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
450//	-1);
451//
452// ```
453func (x *WindowControls) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
454
455	XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
456
457}
458
459// Updates an array of accessible properties.
460//
461// This function should be called by `GtkWidget` types whenever an accessible
462// property change must be communicated to assistive technologies.
463//
464// This function is meant to be used by language bindings.
465func (x *WindowControls) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
466
467	XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
468
469}
470
471// Updates a list of accessible relations.
472//
473// This function should be called by `GtkWidget` types whenever an accessible
474// relation change must be communicated to assistive technologies.
475//
476// If the [enum@Gtk.AccessibleRelation] requires a list of references,
477// you should pass each reference individually, followed by `NULL`, e.g.
478//
479// ```c
480// gtk_accessible_update_relation (accessible,
481//
482//	GTK_ACCESSIBLE_RELATION_CONTROLS,
483//	  ref1, NULL,
484//	GTK_ACCESSIBLE_RELATION_LABELLED_BY,
485//	  ref1, ref2, ref3, NULL,
486//	-1);
487//
488// ```
489func (x *WindowControls) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
490
491	XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
492
493}
494
495// Updates an array of accessible relations.
496//
497// This function should be called by `GtkWidget` types whenever an accessible
498// relation change must be communicated to assistive technologies.
499//
500// This function is meant to be used by language bindings.
501func (x *WindowControls) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
502
503	XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
504
505}
506
507// Updates a list of accessible states.
508//
509// See the [enum@Gtk.AccessibleState] documentation for the
510// value types of accessible states.
511//
512// This function should be called by `GtkWidget` types whenever
513// an accessible state change must be communicated to assistive
514// technologies.
515//
516// Example:
517//
518// ```c
519// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
520// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
521//
522//	GTK_ACCESSIBLE_STATE_CHECKED, value,
523//	-1);
524//
525// ```
526func (x *WindowControls) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
527
528	XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
529
530}
531
532// Updates an array of accessible states.
533//
534// This function should be called by `GtkWidget` types whenever an accessible
535// state change must be communicated to assistive technologies.
536//
537// This function is meant to be used by language bindings.
538func (x *WindowControls) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
539
540	XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
541
542}
543
544// Gets the ID of the @buildable object.
545//
546// `GtkBuilder` sets the name based on the ID attribute
547// of the `<object>` tag used to construct the @buildable.
548func (x *WindowControls) GetBuildableId() string {
549
550	cret := XGtkBuildableGetBuildableId(x.GoPointer())
551	return cret
552}
553
554func init() {
555	core.SetPackageName("GTK", "gtk4")
556	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
557	var libs []uintptr
558	for _, libPath := range core.GetPaths("GTK") {
559		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
560		if err != nil {
561			panic(err)
562		}
563		libs = append(libs, lib)
564	}
565
566	core.PuregoSafeRegister(&xWindowControlsGLibType, libs, "gtk_window_controls_get_type")
567
568	core.PuregoSafeRegister(&xNewWindowControls, libs, "gtk_window_controls_new")
569
570	core.PuregoSafeRegister(&xWindowControlsGetDecorationLayout, libs, "gtk_window_controls_get_decoration_layout")
571	core.PuregoSafeRegister(&xWindowControlsGetEmpty, libs, "gtk_window_controls_get_empty")
572	core.PuregoSafeRegister(&xWindowControlsGetSide, libs, "gtk_window_controls_get_side")
573	core.PuregoSafeRegister(&xWindowControlsGetUseNativeControls, libs, "gtk_window_controls_get_use_native_controls")
574	core.PuregoSafeRegister(&xWindowControlsSetDecorationLayout, libs, "gtk_window_controls_set_decoration_layout")
575	core.PuregoSafeRegister(&xWindowControlsSetSide, libs, "gtk_window_controls_set_side")
576	core.PuregoSafeRegister(&xWindowControlsSetUseNativeControls, libs, "gtk_window_controls_set_use_native_controls")
577
578}

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