v0.2.1 c0399be

gdkpopuplayout.go RawHistoryFolder

1// Package gdk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gdk
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/types"
12)
13
14// Contains information that is necessary position a [iface@Gdk.Popup]
15// relative to its parent.
16//
17// The positioning requires a negotiation with the windowing system,
18// since it depends on external constraints, such as the position of
19// the parent surface, and the screen dimensions.
20//
21// The basic ingredients are a rectangle on the parent surface,
22// and the anchor on both that rectangle and the popup. The anchors
23// specify a side or corner to place next to each other.
24//
25// ![Popup anchors](popup-anchors.png)
26//
27// For cases where placing the anchors next to each other would make
28// the popup extend offscreen, the layout includes some hints for how
29// to resolve this problem. The hints may suggest to flip the anchor
30// position to the other side, or to 'slide' the popup along a side,
31// or to resize it.
32//
33// ![Flipping popups](popup-flip.png)
34//
35// ![Sliding popups](popup-slide.png)
36//
37// These hints may be combined.
38//
39// Ultimatively, it is up to the windowing system to determine the position
40// and size of the popup. You can learn about the result by calling
41// [method@Gdk.Popup.get_position_x], [method@Gdk.Popup.get_position_y],
42// [method@Gdk.Popup.get_rect_anchor] and [method@Gdk.Popup.get_surface_anchor]
43// after the popup has been presented. This can be used to adjust the rendering.
44// For example, [GtkPopover](../gtk4/class.Popover.html) changes its arrow position
45// accordingly. But you have to be careful avoid changing the size of the popover,
46// or it has to be presented again.
47type PopupLayout struct {
48	_ structs.HostLayout
49}
50
51var xPopupLayoutGLibType func() types.GType
52
53func PopupLayoutGLibType() types.GType {
54	return xPopupLayoutGLibType()
55}
56
57func (x *PopupLayout) GoPointer() uintptr {
58	return uintptr(unsafe.Pointer(x))
59}
60
61var xNewPopupLayout func(*Rectangle, Gravity, Gravity) *PopupLayout
62
63// Create a popup layout description.
64//
65// Used together with [method@Gdk.Popup.present] to describe how a popup
66// surface should be placed and behave on-screen.
67//
68// @anchor_rect is relative to the top-left corner of the surface's parent.
69// @rect_anchor and @surface_anchor determine anchor points on @anchor_rect
70// and surface to pin together.
71//
72// The position of @anchor_rect's anchor point can optionally be offset using
73// [method@Gdk.PopupLayout.set_offset], which is equivalent to offsetting the
74// position of surface.
75func NewPopupLayout(AnchorRectVar *Rectangle, RectAnchorVar Gravity, SurfaceAnchorVar Gravity) *PopupLayout {
76
77	cret := xNewPopupLayout(AnchorRectVar, RectAnchorVar, SurfaceAnchorVar)
78	return cret
79}
80
81var xPopupLayoutCopy func(uintptr) *PopupLayout
82
83// Makes a copy of @layout.
84func (x *PopupLayout) Copy() *PopupLayout {
85
86	cret := xPopupLayoutCopy(x.GoPointer())
87	return cret
88}
89
90var xPopupLayoutEqual func(uintptr, *PopupLayout) bool
91
92// Check whether @layout and @other has identical layout properties.
93func (x *PopupLayout) Equal(OtherVar *PopupLayout) bool {
94
95	cret := xPopupLayoutEqual(x.GoPointer(), OtherVar)
96	return cret
97}
98
99var xPopupLayoutGetAnchorHints func(uintptr) AnchorHints
100
101// Get the anchor hints.
102func (x *PopupLayout) GetAnchorHints() AnchorHints {
103
104	cret := xPopupLayoutGetAnchorHints(x.GoPointer())
105	return cret
106}
107
108var xPopupLayoutGetAnchorRect func(uintptr) *Rectangle
109
110// Get the anchor rectangle.
111func (x *PopupLayout) GetAnchorRect() *Rectangle {
112
113	cret := xPopupLayoutGetAnchorRect(x.GoPointer())
114	return cret
115}
116
117var xPopupLayoutGetOffset func(uintptr, *int, *int)
118
119// Retrieves the offset for the anchor rectangle.
120func (x *PopupLayout) GetOffset(DxVar *int, DyVar *int) {
121
122	xPopupLayoutGetOffset(x.GoPointer(), DxVar, DyVar)
123
124}
125
126var xPopupLayoutGetRectAnchor func(uintptr) Gravity
127
128// Returns the anchor position on the anchor rectangle.
129func (x *PopupLayout) GetRectAnchor() Gravity {
130
131	cret := xPopupLayoutGetRectAnchor(x.GoPointer())
132	return cret
133}
134
135var xPopupLayoutGetShadowWidth func(uintptr, *int, *int, *int, *int)
136
137// Obtains the shadow widths of this layout.
138func (x *PopupLayout) GetShadowWidth(LeftVar *int, RightVar *int, TopVar *int, BottomVar *int) {
139
140	xPopupLayoutGetShadowWidth(x.GoPointer(), LeftVar, RightVar, TopVar, BottomVar)
141
142}
143
144var xPopupLayoutGetSurfaceAnchor func(uintptr) Gravity
145
146// Returns the anchor position on the popup surface.
147func (x *PopupLayout) GetSurfaceAnchor() Gravity {
148
149	cret := xPopupLayoutGetSurfaceAnchor(x.GoPointer())
150	return cret
151}
152
153var xPopupLayoutRef func(uintptr) *PopupLayout
154
155// Increases the reference count of @value.
156func (x *PopupLayout) Ref() *PopupLayout {
157
158	cret := xPopupLayoutRef(x.GoPointer())
159	return cret
160}
161
162var xPopupLayoutSetAnchorHints func(uintptr, AnchorHints)
163
164// Set new anchor hints.
165//
166// The set @anchor_hints determines how @surface will be moved
167// if the anchor points cause it to move off-screen. For example,
168// `GDK_ANCHOR_FLIP_X` will replace `GDK_GRAVITY_NORTH_WEST` with
169// `GDK_GRAVITY_NORTH_EAST` and vice versa if @surface extends
170// beyond the left or right edges of the monitor.
171func (x *PopupLayout) SetAnchorHints(AnchorHintsVar AnchorHints) {
172
173	xPopupLayoutSetAnchorHints(x.GoPointer(), AnchorHintsVar)
174
175}
176
177var xPopupLayoutSetAnchorRect func(uintptr, *Rectangle)
178
179// Set the anchor rectangle.
180func (x *PopupLayout) SetAnchorRect(AnchorRectVar *Rectangle) {
181
182	xPopupLayoutSetAnchorRect(x.GoPointer(), AnchorRectVar)
183
184}
185
186var xPopupLayoutSetOffset func(uintptr, int, int)
187
188// Offset the position of the anchor rectangle with the given delta.
189func (x *PopupLayout) SetOffset(DxVar int, DyVar int) {
190
191	xPopupLayoutSetOffset(x.GoPointer(), DxVar, DyVar)
192
193}
194
195var xPopupLayoutSetRectAnchor func(uintptr, Gravity)
196
197// Set the anchor on the anchor rectangle.
198func (x *PopupLayout) SetRectAnchor(AnchorVar Gravity) {
199
200	xPopupLayoutSetRectAnchor(x.GoPointer(), AnchorVar)
201
202}
203
204var xPopupLayoutSetShadowWidth func(uintptr, int, int, int, int)
205
206// Sets the shadow width of the popup.
207//
208// The shadow width corresponds to the part of the computed
209// surface size that would consist of the shadow margin
210// surrounding the window, would there be any.
211func (x *PopupLayout) SetShadowWidth(LeftVar int, RightVar int, TopVar int, BottomVar int) {
212
213	xPopupLayoutSetShadowWidth(x.GoPointer(), LeftVar, RightVar, TopVar, BottomVar)
214
215}
216
217var xPopupLayoutSetSurfaceAnchor func(uintptr, Gravity)
218
219// Set the anchor on the popup surface.
220func (x *PopupLayout) SetSurfaceAnchor(AnchorVar Gravity) {
221
222	xPopupLayoutSetSurfaceAnchor(x.GoPointer(), AnchorVar)
223
224}
225
226var xPopupLayoutUnref func(uintptr)
227
228// Decreases the reference count of @value.
229func (x *PopupLayout) Unref() {
230
231	xPopupLayoutUnref(x.GoPointer())
232
233}
234
235// Positioning hints for aligning a surface relative to a rectangle.
236//
237// These hints determine how the surface should be positioned in the case that
238// the surface would fall off-screen if placed in its ideal position.
239//
240// For example, %GDK_ANCHOR_FLIP_X will replace %GDK_GRAVITY_NORTH_WEST with
241// %GDK_GRAVITY_NORTH_EAST and vice versa if the surface extends beyond the left
242// or right edges of the monitor.
243//
244// If %GDK_ANCHOR_SLIDE_X is set, the surface can be shifted horizontally to fit
245// on-screen. If %GDK_ANCHOR_RESIZE_X is set, the surface can be shrunken
246// horizontally to fit.
247//
248// In general, when multiple flags are set, flipping should take precedence over
249// sliding, which should take precedence over resizing.
250type AnchorHints int
251
252var xAnchorHintsGLibType func() types.GType
253
254func AnchorHintsGLibType() types.GType {
255	return xAnchorHintsGLibType()
256}
257
258const (
259
260	// allow flipping anchors horizontally
261	AnchorFlipXValue AnchorHints = 1
262	// allow flipping anchors vertically
263	AnchorFlipYValue AnchorHints = 2
264	// allow sliding surface horizontally
265	AnchorSlideXValue AnchorHints = 4
266	// allow sliding surface vertically
267	AnchorSlideYValue AnchorHints = 8
268	// allow resizing surface horizontally
269	AnchorResizeXValue AnchorHints = 16
270	// allow resizing surface vertically
271	AnchorResizeYValue AnchorHints = 32
272	// allow flipping anchors on both axes
273	AnchorFlipValue AnchorHints = 3
274	// allow sliding surface on both axes
275	AnchorSlideValue AnchorHints = 12
276	// allow resizing surface on both axes
277	AnchorResizeValue AnchorHints = 48
278)
279
280func init() {
281	core.SetPackageName("GDK", "gtk4")
282	core.SetSharedLibraries("GDK", []string{"libgtk-4.so.1"})
283	var libs []uintptr
284	for _, libPath := range core.GetPaths("GDK") {
285		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
286		if err != nil {
287			panic(err)
288		}
289		libs = append(libs, lib)
290	}
291
292	core.PuregoSafeRegister(&xAnchorHintsGLibType, libs, "gdk_anchor_hints_get_type")
293
294	core.PuregoSafeRegister(&xPopupLayoutGLibType, libs, "gdk_popup_layout_get_type")
295
296	core.PuregoSafeRegister(&xNewPopupLayout, libs, "gdk_popup_layout_new")
297
298	core.PuregoSafeRegister(&xPopupLayoutCopy, libs, "gdk_popup_layout_copy")
299	core.PuregoSafeRegister(&xPopupLayoutEqual, libs, "gdk_popup_layout_equal")
300	core.PuregoSafeRegister(&xPopupLayoutGetAnchorHints, libs, "gdk_popup_layout_get_anchor_hints")
301	core.PuregoSafeRegister(&xPopupLayoutGetAnchorRect, libs, "gdk_popup_layout_get_anchor_rect")
302	core.PuregoSafeRegister(&xPopupLayoutGetOffset, libs, "gdk_popup_layout_get_offset")
303	core.PuregoSafeRegister(&xPopupLayoutGetRectAnchor, libs, "gdk_popup_layout_get_rect_anchor")
304	core.PuregoSafeRegister(&xPopupLayoutGetShadowWidth, libs, "gdk_popup_layout_get_shadow_width")
305	core.PuregoSafeRegister(&xPopupLayoutGetSurfaceAnchor, libs, "gdk_popup_layout_get_surface_anchor")
306	core.PuregoSafeRegister(&xPopupLayoutRef, libs, "gdk_popup_layout_ref")
307	core.PuregoSafeRegister(&xPopupLayoutSetAnchorHints, libs, "gdk_popup_layout_set_anchor_hints")
308	core.PuregoSafeRegister(&xPopupLayoutSetAnchorRect, libs, "gdk_popup_layout_set_anchor_rect")
309	core.PuregoSafeRegister(&xPopupLayoutSetOffset, libs, "gdk_popup_layout_set_offset")
310	core.PuregoSafeRegister(&xPopupLayoutSetRectAnchor, libs, "gdk_popup_layout_set_rect_anchor")
311	core.PuregoSafeRegister(&xPopupLayoutSetShadowWidth, libs, "gdk_popup_layout_set_shadow_width")
312	core.PuregoSafeRegister(&xPopupLayoutSetSurfaceAnchor, libs, "gdk_popup_layout_set_surface_anchor")
313	core.PuregoSafeRegister(&xPopupLayoutUnref, libs, "gdk_popup_layout_unref")
314
315}

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