-
Notifications
You must be signed in to change notification settings - Fork 6
/
adw-window.go
312 lines (271 loc) · 7.67 KB
/
adw-window.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"runtime"
"unsafe"
"github.com/diamondburned/gotk4/pkg/core/gextras"
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
"github.com/diamondburned/gotk4/pkg/gtk/v4"
)
// #include <stdlib.h>
// #include <adwaita.h>
// #include <glib-object.h>
import "C"
// GType values.
var (
GTypeWindow = coreglib.Type(C.adw_window_get_type())
)
func init() {
coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{
coreglib.TypeMarshaler{T: GTypeWindow, F: marshalWindow},
})
}
// WindowOverrides contains methods that are overridable.
type WindowOverrides struct {
}
func defaultWindowOverrides(v *Window) WindowOverrides {
return WindowOverrides{}
}
// Window: freeform window.
//
// <picture> <source srcset="window-dark.png" media="(prefers-color-scheme:
// dark)"> <img src="window.png" alt="window"> </picture>
//
// The AdwWindow widget is a subclass of gtk.Window which has no titlebar area.
// Instead, toolbarview can be used together with headerbar or gtk.HeaderBar as
// follows:
//
// <object class="AdwWindow">
// <property name="content">
// <object class="AdwToolbarView">
// <child type="top">
// <object class="AdwHeaderBar"/>
// </child>
// <property name="content">
// <!-- ... -->
// </property>
// </object>
// </property>
// </object>
//
// Using gtk.Window:titlebar or gtk.Window:child is not supported and will
// result in a crash. Use window:content instead.
//
// # Breakpoints
//
// AdwWindow can be used with breakpoint the same way as breakpointbin. Refer to
// that widget's documentation for details.
//
// Example:
//
// <object class="AdwWindow">
// <property name="width-request">360</property>
// <property name="height-request">200</property>
// <property name="content">
// <object class="AdwToolbarView">
// <child type="top">
// <object class="AdwHeaderBar"/>
// </child>
// <property name="content">
// <!-- ... -->
// </property>
// <child type="bottom">
// <object class="GtkActionBar" id="bottom_bar">
// <property name="revealed">True</property>
// <property name="visible">False</property>
// </object>
// </child>
// </object>
// </property>
// <child>
// <object class="AdwBreakpoint">
// <condition>max-width: 500px</condition>
// <setter object="bottom_bar" property="visible">True</setter>
// </object>
// </child>
// </object>
//
// Like AdwBreakpointBin, if breakpoints are used, AdwWindow doesn't have a
// minimum size, and gtk.Widget:width-request and gtk.Widget:height-request
// properties must be set manually.
type Window struct {
_ [0]func() // equal guard
gtk.Window
}
var (
_ gtk.Widgetter = (*Window)(nil)
_ coreglib.Objector = (*Window)(nil)
)
func init() {
coreglib.RegisterClassInfo[*Window, *WindowClass, WindowOverrides](
GTypeWindow,
initWindowClass,
wrapWindow,
defaultWindowOverrides,
)
}
func initWindowClass(gclass unsafe.Pointer, overrides WindowOverrides, classInitFunc func(*WindowClass)) {
if classInitFunc != nil {
class := (*WindowClass)(gextras.NewStructNative(gclass))
classInitFunc(class)
}
}
func wrapWindow(obj *coreglib.Object) *Window {
return &Window{
Window: gtk.Window{
Widget: gtk.Widget{
InitiallyUnowned: coreglib.InitiallyUnowned{
Object: obj,
},
Object: obj,
Accessible: gtk.Accessible{
Object: obj,
},
Buildable: gtk.Buildable{
Object: obj,
},
ConstraintTarget: gtk.ConstraintTarget{
Object: obj,
},
},
Object: obj,
Root: gtk.Root{
NativeSurface: gtk.NativeSurface{
Widget: gtk.Widget{
InitiallyUnowned: coreglib.InitiallyUnowned{
Object: obj,
},
Object: obj,
Accessible: gtk.Accessible{
Object: obj,
},
Buildable: gtk.Buildable{
Object: obj,
},
ConstraintTarget: gtk.ConstraintTarget{
Object: obj,
},
},
},
},
ShortcutManager: gtk.ShortcutManager{
Object: obj,
},
},
}
}
func marshalWindow(p uintptr) (interface{}, error) {
return wrapWindow(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil
}
// NewWindow creates a new AdwWindow.
//
// The function returns the following values:
//
// - window: newly created AdwWindow.
//
func NewWindow() *Window {
var _cret *C.GtkWidget // in
_cret = C.adw_window_new()
var _window *Window // out
_window = wrapWindow(coreglib.Take(unsafe.Pointer(_cret)))
return _window
}
// AddBreakpoint adds breakpoint to self.
//
// The function takes the following parameters:
//
// - breakpoint to add.
//
func (self *Window) AddBreakpoint(breakpoint *Breakpoint) {
var _arg0 *C.AdwWindow // out
var _arg1 *C.AdwBreakpoint // out
_arg0 = (*C.AdwWindow)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_arg1 = (*C.AdwBreakpoint)(unsafe.Pointer(coreglib.InternObject(breakpoint).Native()))
C.g_object_ref(C.gpointer(coreglib.InternObject(breakpoint).Native()))
C.adw_window_add_breakpoint(_arg0, _arg1)
runtime.KeepAlive(self)
runtime.KeepAlive(breakpoint)
}
// Content gets the content widget of self.
//
// This method should always be used instead of gtk.Window.GetChild().
//
// The function returns the following values:
//
// - widget (optional): content widget of self.
//
func (self *Window) Content() gtk.Widgetter {
var _arg0 *C.AdwWindow // out
var _cret *C.GtkWidget // in
_arg0 = (*C.AdwWindow)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_cret = C.adw_window_get_content(_arg0)
runtime.KeepAlive(self)
var _widget gtk.Widgetter // out
if _cret != nil {
{
objptr := unsafe.Pointer(_cret)
object := coreglib.Take(objptr)
casted := object.WalkCast(func(obj coreglib.Objector) bool {
_, ok := obj.(gtk.Widgetter)
return ok
})
rv, ok := casted.(gtk.Widgetter)
if !ok {
panic("no marshaler for " + object.TypeFromInstance().String() + " matching gtk.Widgetter")
}
_widget = rv
}
}
return _widget
}
// CurrentBreakpoint gets the current breakpoint.
//
// The function returns the following values:
//
// - breakpoint (optional): current breakpoint.
//
func (self *Window) CurrentBreakpoint() *Breakpoint {
var _arg0 *C.AdwWindow // out
var _cret *C.AdwBreakpoint // in
_arg0 = (*C.AdwWindow)(unsafe.Pointer(coreglib.InternObject(self).Native()))
_cret = C.adw_window_get_current_breakpoint(_arg0)
runtime.KeepAlive(self)
var _breakpoint *Breakpoint // out
if _cret != nil {
_breakpoint = wrapBreakpoint(coreglib.Take(unsafe.Pointer(_cret)))
}
return _breakpoint
}
// SetContent sets the content widget of self.
//
// This method should always be used instead of gtk.Window.SetChild().
//
// The function takes the following parameters:
//
// - content (optional) widget.
//
func (self *Window) SetContent(content gtk.Widgetter) {
var _arg0 *C.AdwWindow // out
var _arg1 *C.GtkWidget // out
_arg0 = (*C.AdwWindow)(unsafe.Pointer(coreglib.InternObject(self).Native()))
if content != nil {
_arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(content).Native()))
}
C.adw_window_set_content(_arg0, _arg1)
runtime.KeepAlive(self)
runtime.KeepAlive(content)
}
// WindowClass: instance of this type is always passed by reference.
type WindowClass struct {
*windowClass
}
// windowClass is the struct that's finalized.
type windowClass struct {
native *C.AdwWindowClass
}
func (w *WindowClass) ParentClass() *gtk.WindowClass {
valptr := &w.native.parent_class
var _v *gtk.WindowClass // out
_v = (*gtk.WindowClass)(gextras.NewStructNative(unsafe.Pointer(valptr)))
return _v
}