gtkwindowgroup.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/glib"
12 "github.com/bnema/puregotk/v4/gobject"
13 "github.com/bnema/puregotk/v4/gobject/types"
14)
15
16type WindowGroupClass struct {
17 _ structs.HostLayout
18
19 ParentClass gobject.ObjectClass
20
21 xGtkReserved1 uintptr
22
23 xGtkReserved2 uintptr
24
25 xGtkReserved3 uintptr
26
27 xGtkReserved4 uintptr
28}
29
30func (x *WindowGroupClass) GoPointer() uintptr {
31 return uintptr(unsafe.Pointer(x))
32}
33
34// OverrideGtkReserved1 sets the "_gtk_reserved1" callback function.
35func (x *WindowGroupClass) OverrideGtkReserved1(cb func()) {
36 if cb == nil {
37 x.xGtkReserved1 = 0
38 } else {
39 x.xGtkReserved1 = purego.NewCallback(func() {
40 cb()
41 })
42 }
43}
44
45// GetGtkReserved1 gets the "_gtk_reserved1" callback function.
46func (x *WindowGroupClass) GetGtkReserved1() func() {
47 if x.xGtkReserved1 == 0 {
48 return nil
49 }
50 var rawCallback func()
51 purego.RegisterFunc(&rawCallback, x.xGtkReserved1)
52 return func() {
53 rawCallback()
54 }
55}
56
57// OverrideGtkReserved2 sets the "_gtk_reserved2" callback function.
58func (x *WindowGroupClass) OverrideGtkReserved2(cb func()) {
59 if cb == nil {
60 x.xGtkReserved2 = 0
61 } else {
62 x.xGtkReserved2 = purego.NewCallback(func() {
63 cb()
64 })
65 }
66}
67
68// GetGtkReserved2 gets the "_gtk_reserved2" callback function.
69func (x *WindowGroupClass) GetGtkReserved2() func() {
70 if x.xGtkReserved2 == 0 {
71 return nil
72 }
73 var rawCallback func()
74 purego.RegisterFunc(&rawCallback, x.xGtkReserved2)
75 return func() {
76 rawCallback()
77 }
78}
79
80// OverrideGtkReserved3 sets the "_gtk_reserved3" callback function.
81func (x *WindowGroupClass) OverrideGtkReserved3(cb func()) {
82 if cb == nil {
83 x.xGtkReserved3 = 0
84 } else {
85 x.xGtkReserved3 = purego.NewCallback(func() {
86 cb()
87 })
88 }
89}
90
91// GetGtkReserved3 gets the "_gtk_reserved3" callback function.
92func (x *WindowGroupClass) GetGtkReserved3() func() {
93 if x.xGtkReserved3 == 0 {
94 return nil
95 }
96 var rawCallback func()
97 purego.RegisterFunc(&rawCallback, x.xGtkReserved3)
98 return func() {
99 rawCallback()
100 }
101}
102
103// OverrideGtkReserved4 sets the "_gtk_reserved4" callback function.
104func (x *WindowGroupClass) OverrideGtkReserved4(cb func()) {
105 if cb == nil {
106 x.xGtkReserved4 = 0
107 } else {
108 x.xGtkReserved4 = purego.NewCallback(func() {
109 cb()
110 })
111 }
112}
113
114// GetGtkReserved4 gets the "_gtk_reserved4" callback function.
115func (x *WindowGroupClass) GetGtkReserved4() func() {
116 if x.xGtkReserved4 == 0 {
117 return nil
118 }
119 var rawCallback func()
120 purego.RegisterFunc(&rawCallback, x.xGtkReserved4)
121 return func() {
122 rawCallback()
123 }
124}
125
126// Creates groups of windows that behave like separate applications.
127//
128// It achieves this by limiting the effect of GTK grabs and modality
129// to windows in the same group.
130//
131// A window can be a member in at most one window group at a time.
132// Windows that have not been explicitly assigned to a group are
133// implicitly treated like windows of the default window group.
134//
135// `GtkWindowGroup` objects are referenced by each window in the group,
136// so once you have added all windows to a `GtkWindowGroup`, you can drop
137// the initial reference to the window group with g_object_unref(). If the
138// windows in the window group are subsequently destroyed, then they will
139// be removed from the window group and drop their references on the window
140// group; when all window have been removed, the window group will be
141// freed.
142type WindowGroup struct {
143 gobject.Object
144}
145
146var xWindowGroupGLibType func() types.GType
147
148func WindowGroupGLibType() types.GType {
149 return xWindowGroupGLibType()
150}
151
152func WindowGroupNewFromInternalPtr(ptr uintptr) *WindowGroup {
153 cls := &WindowGroup{}
154 cls.Ptr = ptr
155 return cls
156}
157
158var xNewWindowGroup func() uintptr
159
160// Creates a new `GtkWindowGroup` object.
161//
162// Modality of windows only affects windows
163// within the same `GtkWindowGroup`.
164func NewWindowGroup() *WindowGroup {
165 var cls *WindowGroup
166
167 cret := xNewWindowGroup()
168
169 if cret == 0 {
170 return nil
171 }
172 cls = &WindowGroup{}
173 cls.Ptr = cret
174 return cls
175}
176
177var xWindowGroupAddWindow func(uintptr, uintptr)
178
179// Adds a window to a `GtkWindowGroup`.
180func (x *WindowGroup) AddWindow(WindowVar *Window) {
181
182 xWindowGroupAddWindow(x.GoPointer(), WindowVar.GoPointer())
183
184}
185
186var xWindowGroupListWindows func(uintptr) *glib.List
187
188// Returns a list of the `GtkWindows` that belong to @window_group.
189func (x *WindowGroup) ListWindows() *glib.List {
190
191 cret := xWindowGroupListWindows(x.GoPointer())
192 return cret
193}
194
195var xWindowGroupRemoveWindow func(uintptr, uintptr)
196
197// Removes a window from a `GtkWindowGroup`.
198func (x *WindowGroup) RemoveWindow(WindowVar *Window) {
199
200 xWindowGroupRemoveWindow(x.GoPointer(), WindowVar.GoPointer())
201
202}
203
204func (c *WindowGroup) GoPointer() uintptr {
205 if c == nil {
206 return 0
207 }
208 return c.Ptr
209}
210
211func (c *WindowGroup) SetGoPointer(ptr uintptr) {
212 c.Ptr = ptr
213}
214
215func init() {
216 core.SetPackageName("GTK", "gtk4")
217 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
218 var libs []uintptr
219 for _, libPath := range core.GetPaths("GTK") {
220 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
221 if err != nil {
222 panic(err)
223 }
224 libs = append(libs, lib)
225 }
226
227 core.PuregoSafeRegister(&xWindowGroupGLibType, libs, "gtk_window_group_get_type")
228
229 core.PuregoSafeRegister(&xNewWindowGroup, libs, "gtk_window_group_new")
230
231 core.PuregoSafeRegister(&xWindowGroupAddWindow, libs, "gtk_window_group_add_window")
232 core.PuregoSafeRegister(&xWindowGroupListWindows, libs, "gtk_window_group_list_windows")
233 core.PuregoSafeRegister(&xWindowGroupRemoveWindow, libs, "gtk_window_group_remove_window")
234
235}