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/gdk"
12 "github.com/bnema/puregotk/v4/gobject"
13 "github.com/bnema/puregotk/v4/gobject/types"
14)
15
16type GestureSingleClass struct {
17 _ structs.HostLayout
18}
19
20func (x *GestureSingleClass) GoPointer() uintptr {
21 return uintptr(unsafe.Pointer(x))
22}
23
24// A `GtkGesture` subclass optimized for singe-touch and mouse gestures.
25//
26// Under interaction, these gestures stick to the first interacting sequence,
27// which is accessible through [method@Gtk.GestureSingle.get_current_sequence]
28// while the gesture is being interacted with.
29//
30// By default gestures react to both %GDK_BUTTON_PRIMARY and touch events.
31// [method@Gtk.GestureSingle.set_touch_only] can be used to change the
32// touch behavior. Callers may also specify a different mouse button number
33// to interact with through [method@Gtk.GestureSingle.set_button], or react
34// to any mouse button by setting it to 0. While the gesture is active, the
35// button being currently pressed can be known through
36// [method@Gtk.GestureSingle.get_current_button].
37type GestureSingle struct {
38 Gesture
39}
40
41var xGestureSingleGLibType func() types.GType
42
43func GestureSingleGLibType() types.GType {
44 return xGestureSingleGLibType()
45}
46
47func GestureSingleNewFromInternalPtr(ptr uintptr) *GestureSingle {
48 cls := &GestureSingle{}
49 cls.Ptr = ptr
50 return cls
51}
52
53var xGestureSingleGetButton func(uintptr) uint
54
55// Returns the button number @gesture listens for.
56//
57// If this is 0, the gesture reacts to any button press.
58func (x *GestureSingle) GetButton() uint {
59
60 cret := xGestureSingleGetButton(x.GoPointer())
61 return cret
62}
63
64var xGestureSingleGetCurrentButton func(uintptr) uint
65
66// Returns the button number currently interacting
67// with @gesture, or 0 if there is none.
68func (x *GestureSingle) GetCurrentButton() uint {
69
70 cret := xGestureSingleGetCurrentButton(x.GoPointer())
71 return cret
72}
73
74var xGestureSingleGetCurrentSequence func(uintptr) *gdk.EventSequence
75
76// Returns the event sequence currently interacting with @gesture.
77//
78// This is only meaningful if [method@Gtk.Gesture.is_active]
79// returns %TRUE.
80func (x *GestureSingle) GetCurrentSequence() *gdk.EventSequence {
81
82 cret := xGestureSingleGetCurrentSequence(x.GoPointer())
83 return cret
84}
85
86var xGestureSingleGetExclusive func(uintptr) bool
87
88// Gets whether a gesture is exclusive.
89//
90// For more information, see [method@Gtk.GestureSingle.set_exclusive].
91func (x *GestureSingle) GetExclusive() bool {
92
93 cret := xGestureSingleGetExclusive(x.GoPointer())
94 return cret
95}
96
97var xGestureSingleGetTouchOnly func(uintptr) bool
98
99// Returns %TRUE if the gesture is only triggered by touch events.
100func (x *GestureSingle) GetTouchOnly() bool {
101
102 cret := xGestureSingleGetTouchOnly(x.GoPointer())
103 return cret
104}
105
106var xGestureSingleSetButton func(uintptr, uint)
107
108// Sets the button number @gesture listens to.
109//
110// If non-0, every button press from a different button
111// number will be ignored. Touch events implicitly match
112// with button 1.
113func (x *GestureSingle) SetButton(ButtonVar uint) {
114
115 xGestureSingleSetButton(x.GoPointer(), ButtonVar)
116
117}
118
119var xGestureSingleSetExclusive func(uintptr, bool)
120
121// Sets whether @gesture is exclusive.
122//
123// An exclusive gesture will only handle pointer and "pointer emulated"
124// touch events, so at any given time, there is only one sequence able
125// to interact with those.
126func (x *GestureSingle) SetExclusive(ExclusiveVar bool) {
127
128 xGestureSingleSetExclusive(x.GoPointer(), ExclusiveVar)
129
130}
131
132var xGestureSingleSetTouchOnly func(uintptr, bool)
133
134// Sets whether to handle only touch events.
135//
136// If @touch_only is %TRUE, @gesture will only handle events of type
137// %GDK_TOUCH_BEGIN, %GDK_TOUCH_UPDATE or %GDK_TOUCH_END. If %FALSE,
138// mouse events will be handled too.
139func (x *GestureSingle) SetTouchOnly(TouchOnlyVar bool) {
140
141 xGestureSingleSetTouchOnly(x.GoPointer(), TouchOnlyVar)
142
143}
144
145func (c *GestureSingle) GoPointer() uintptr {
146 if c == nil {
147 return 0
148 }
149 return c.Ptr
150}
151
152func (c *GestureSingle) SetGoPointer(ptr uintptr) {
153 c.Ptr = ptr
154}
155
156// SetPropertyButton sets the "button" property.
157// Mouse button number to listen to, or 0 to listen for any button.
158func (x *GestureSingle) SetPropertyButton(value uint) {
159 var v gobject.Value
160 v.Init(gobject.TypeUintVal)
161 v.SetUint(value)
162 x.SetProperty("button", &v)
163}
164
165// GetPropertyButton gets the "button" property.
166// Mouse button number to listen to, or 0 to listen for any button.
167func (x *GestureSingle) GetPropertyButton() uint {
168 var v gobject.Value
169 x.GetProperty("button", &v)
170 return v.GetUint()
171}
172
173// SetPropertyExclusive sets the "exclusive" property.
174// Whether the gesture is exclusive.
175//
176// Exclusive gestures only listen to pointer and pointer emulated events.
177func (x *GestureSingle) SetPropertyExclusive(value bool) {
178 var v gobject.Value
179 v.Init(gobject.TypeBooleanVal)
180 v.SetBoolean(value)
181 x.SetProperty("exclusive", &v)
182}
183
184// GetPropertyExclusive gets the "exclusive" property.
185// Whether the gesture is exclusive.
186//
187// Exclusive gestures only listen to pointer and pointer emulated events.
188func (x *GestureSingle) GetPropertyExclusive() bool {
189 var v gobject.Value
190 x.GetProperty("exclusive", &v)
191 return v.GetBoolean()
192}
193
194// SetPropertyTouchOnly sets the "touch-only" property.
195// Whether the gesture handles only touch events.
196func (x *GestureSingle) SetPropertyTouchOnly(value bool) {
197 var v gobject.Value
198 v.Init(gobject.TypeBooleanVal)
199 v.SetBoolean(value)
200 x.SetProperty("touch-only", &v)
201}
202
203// GetPropertyTouchOnly gets the "touch-only" property.
204// Whether the gesture handles only touch events.
205func (x *GestureSingle) GetPropertyTouchOnly() bool {
206 var v gobject.Value
207 x.GetProperty("touch-only", &v)
208 return v.GetBoolean()
209}
210
211func init() {
212 core.SetPackageName("GTK", "gtk4")
213 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
214 var libs []uintptr
215 for _, libPath := range core.GetPaths("GTK") {
216 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
217 if err != nil {
218 panic(err)
219 }
220 libs = append(libs, lib)
221 }
222
223 core.PuregoSafeRegister(&xGestureSingleGLibType, libs, "gtk_gesture_single_get_type")
224
225 core.PuregoSafeRegister(&xGestureSingleGetButton, libs, "gtk_gesture_single_get_button")
226 core.PuregoSafeRegister(&xGestureSingleGetCurrentButton, libs, "gtk_gesture_single_get_current_button")
227 core.PuregoSafeRegister(&xGestureSingleGetCurrentSequence, libs, "gtk_gesture_single_get_current_sequence")
228 core.PuregoSafeRegister(&xGestureSingleGetExclusive, libs, "gtk_gesture_single_get_exclusive")
229 core.PuregoSafeRegister(&xGestureSingleGetTouchOnly, libs, "gtk_gesture_single_get_touch_only")
230 core.PuregoSafeRegister(&xGestureSingleSetButton, libs, "gtk_gesture_single_set_button")
231 core.PuregoSafeRegister(&xGestureSingleSetExclusive, libs, "gtk_gesture_single_set_exclusive")
232 core.PuregoSafeRegister(&xGestureSingleSetTouchOnly, libs, "gtk_gesture_single_set_touch_only")
233
234}