Debian Codegraph @

gtk/gtk_since_3_16.go

raw symbols SCIP
1 // +build !gtk_3_6,!gtk_3_8,!gtk_3_10,!gtk_3_12,!gtk_3_14
2
3 // See: https://developer.gnome.org/gtk3/3.16/api-index-3-16.html
4
5 package gtk
6
7 // #include <gtk/gtk.h>
8 // #include "gtk_since_3_16.go.h"
9 import "C"
10 import (
11 "unsafe"
12
13 "github.com/gotk3/gotk3/gdk"
14 "github.com/gotk3/gotk3/glib"
15 )
16
17 const (
18 POLICY_EXTERNAL PolicyType = C.GTK_POLICY_EXTERNAL
19 )
20
21 func init() {
22 tm := []glib.TypeMarshaler{
23
24 // Objects/Interfaces
25 {glib.Type(C.gtk_button_role_get_type()), marshalButtonRole},
26 {glib.Type(C.gtk_popover_menu_get_type()), marshalPopoverMenu},
27 {glib.Type(C.gtk_model_button_get_type()), marshalModelButton},
28 {glib.Type(C.gtk_stack_sidebar_get_type()), marshalStackSidebar},
29 {glib.Type(C.gtk_text_extend_selection_get_type()), marshalTextExtendSelection},
30 }
31 glib.RegisterGValueMarshalers(tm)
32
33 //Contribute to casting
34 for k, v := range map[string]WrapFn{
35 "GtkPopoverMenu": wrapPopoverMenu,
36 "GtkModelButton": wrapModelButton,
37 "GtkStackSidebar": wrapStackSidebar,
38 } {
39 WrapMap[k] = v
40 }
41 }
42
43 /*
44 * Constants
45 */
46
47 // ButtonRole is a representation of GTK's GtkButtonRole.
48 type ButtonRole int
49
50 const (
51 BUTTON_ROLE_NORMAL ButtonRole = C.GTK_BUTTON_ROLE_NORMAL
52 BUTTON_ROLE_CHECK ButtonRole = C.GTK_BUTTON_ROLE_CHECK
53 BUTTON_ROLE_RADIO ButtonRole = C.GTK_BUTTON_ROLE_RADIO
54 )
55
56 func marshalButtonRole(p uintptr) (interface{}, error) {
57 c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
58 return ButtonRole(c), nil
59 }
60
61 /*
62 * TextView
63 */
64
65 // TextExtendSelection is a representation of GTK's GtkTextExtendSelection.
66 type TextExtendSelection int
67
68 const (
69 TEXT_EXTEND_SELECTION_WORD TextExtendSelection = C.GTK_TEXT_EXTEND_SELECTION_WORD
70 TEXT_EXTEND_SELECTION_LINE TextExtendSelection = C.GTK_TEXT_EXTEND_SELECTION_LINE
71 )
72
73 func marshalTextExtendSelection(p uintptr) (interface{}, error) {
74 c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
75 return TextExtendSelection(c), nil
76 }
77
78 /*
79 * GtkStack
80 */
81
82 // SetHHomogeneous is a wrapper around gtk_stack_set_hhomogeneous().
83 func (v *Stack) SetHHomogeneous(hhomogeneous bool) {
84 C.gtk_stack_set_hhomogeneous(v.native(), gbool(hhomogeneous))
85 }
86
87 // GetHHomogeneous is a wrapper around gtk_stack_get_hhomogeneous().
88 func (v *Stack) GetHHomogeneous() bool {
89 return gobool(C.gtk_stack_get_hhomogeneous(v.native()))
90 }
91
92 // SetVHomogeneous is a wrapper around gtk_stack_set_vhomogeneous().
93 func (v *Stack) SetVHomogeneous(vhomogeneous bool) {
94 C.gtk_stack_set_vhomogeneous(v.native(), gbool(vhomogeneous))
95 }
96
97 // GetVHomogeneous is a wrapper around gtk_stack_get_vhomogeneous().
98 func (v *Stack) GetVHomogeneous() bool {
99 return gobool(C.gtk_stack_get_vhomogeneous(v.native()))
100 }
101
102 /*
103 * GtkNotebook
104 */
105
106 // DetachTab is a wrapper around gtk_notebook_detach_tab().
107 func (v *Notebook) DetachTab(child IWidget) {
108 C.gtk_notebook_detach_tab(v.native(), child.toWidget())
109 }
110
111 /*
112 * GtkListBox
113 */
114
115 // ListBoxCreateWidgetFunc is a representation of GtkListBoxCreateWidgetFunc.
116 type ListBoxCreateWidgetFunc func(item interface{}) int
117
118 /*
119 * GtkScrolledWindow
120 */
121
122 // SetOverlayScrolling is a wrapper around gtk_scrolled_window_set_overlay_scrolling().
123 func (v *ScrolledWindow) SetOverlayScrolling(scrolling bool) {
124 C.gtk_scrolled_window_set_overlay_scrolling(v.native(), gbool(scrolling))
125 }
126
127 // GetOverlayScrolling is a wrapper around gtk_scrolled_window_get_overlay_scrolling().
128 func (v *ScrolledWindow) GetOverlayScrolling() bool {
129 return gobool(C.gtk_scrolled_window_get_overlay_scrolling(v.native()))
130 }
131
132 /*
133 * GtkPaned
134 */
135
136 // SetWideHandle is a wrapper around gtk_paned_set_wide_handle().
137 func (v *Paned) SetWideHandle(wide bool) {
138 C.gtk_paned_set_wide_handle(v.native(), gbool(wide))
139 }
140
141 // GetWideHandle is a wrapper around gtk_paned_get_wide_handle().
142 func (v *Paned) GetWideHandle() bool {
143 return gobool(C.gtk_paned_get_wide_handle(v.native()))
144 }
145
146 /*
147 * GtkLabel
148 */
149
150 // GetXAlign is a wrapper around gtk_label_get_xalign().
151 func (v *Label) GetXAlign() float64 {
152 c := C.gtk_label_get_xalign(v.native())
153 return float64(c)
154 }
155
156 // GetYAlign is a wrapper around gtk_label_get_yalign().
157 func (v *Label) GetYAlign() float64 {
158 c := C.gtk_label_get_yalign(v.native())
159 return float64(c)
160 }
161
162 // SetXAlign is a wrapper around gtk_label_set_xalign().
163 func (v *Label) SetXAlign(n float64) {
164 C.gtk_label_set_xalign(v.native(), C.gfloat(n))
165 }
166
167 // SetYAlign is a wrapper around gtk_label_set_yalign().
168 func (v *Label) SetYAlign(n float64) {
169 C.gtk_label_set_yalign(v.native(), C.gfloat(n))
170 }
171
172 /*
173 * GtkModelButton
174 */
175
176 // ModelButton is a representation of GTK's GtkModelButton.
177 type ModelButton struct {
178 Button
179 }
180
181 func (v *ModelButton) native() *C.GtkModelButton {
182 if v == nil || v.GObject == nil {
183 return nil
184 }
185
186 p := unsafe.Pointer(v.GObject)
187 return C.toGtkModelButton(p)
188 }
189
190 func marshalModelButton(p uintptr) (interface{}, error) {
191 c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p)))
192 return wrapModelButton(glib.Take(unsafe.Pointer(c))), nil
193 }
194
195 func wrapModelButton(obj *glib.Object) *ModelButton {
196 if obj == nil {
197 return nil
198 }
199
200 actionable := wrapActionable(obj)
201 return &ModelButton{Button{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}, actionable}}
202 }
203
204 // ModelButtonNew is a wrapper around gtk_model_button_new
205 func ModelButtonNew() (*ModelButton, error) {
206 c := C.gtk_model_button_new()
207 if c == nil {
208 return nil, nilPtrErr
209 }
210 return wrapModelButton(glib.Take(unsafe.Pointer(c))), nil
211 }
212
213 /*
214 * GtkPopoverMenu
215 */
216
217 // PopoverMenu is a representation of GTK's GtkPopoverMenu.
218 type PopoverMenu struct {
219 Popover
220 }
221
222 func (v *PopoverMenu) native() *C.GtkPopoverMenu {
223 if v == nil || v.GObject == nil {
224 return nil
225 }
226
227 p := unsafe.Pointer(v.GObject)
228 return C.toGtkPopoverMenu(p)
229 }
230
231 func marshalPopoverMenu(p uintptr) (interface{}, error) {
232 c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p)))
233 return wrapPopoverMenu(glib.Take(unsafe.Pointer(c))), nil
234 }
235
236 func wrapPopoverMenu(obj *glib.Object) *PopoverMenu {
237 if obj == nil {
238 return nil
239 }
240
241 return &PopoverMenu{Popover{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}}}
242 }
243
244 // PopoverMenuNew is a wrapper around gtk_popover_menu_new
245 func PopoverMenuNew() (*PopoverMenu, error) {
246 c := C.gtk_popover_menu_new()
247 if c == nil {
248 return nil, nilPtrErr
249 }
250 return wrapPopoverMenu(glib.Take(unsafe.Pointer(c))), nil
251 }
252
253 // OpenSubmenu is a wrapper around gtk_popover_menu_open_submenu
254 func (v *PopoverMenu) OpenSubmenu(name string) {
255 cstr1 := (*C.gchar)(C.CString(name))
256 defer C.free(unsafe.Pointer(cstr1))
257
258 C.gtk_popover_menu_open_submenu(v.native(), cstr1)
259 }
260
261 /*
262 * GtkStackSidebar
263 */
264
265 // StackSidebar is a representation of GTK's GtkStackSidebar.
266 type StackSidebar struct {
267 Bin
268 }
269
270 // native returns a pointer to the underlying GtkStack.
271 func (v *StackSidebar) native() *C.GtkStackSidebar {
272 if v == nil || v.GObject == nil {
273 return nil
274 }
275 p := unsafe.Pointer(v.GObject)
276 return C.toGtkStackSidebar(p)
277 }
278
279 func marshalStackSidebar(p uintptr) (interface{}, error) {
280 c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p)))
281 obj := glib.Take(unsafe.Pointer(c))
282 return wrapStackSidebar(obj), nil
283 }
284
285 func wrapStackSidebar(obj *glib.Object) *StackSidebar {
286 if obj == nil {
287 return nil
288 }
289
290 return &StackSidebar{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}}
291 }
292
293 // StackSidebarNew is a wrapper around gtk_stack_sidebar_new().
294 func StackSidebarNew() (*StackSidebar, error) {
295 c := C.gtk_stack_sidebar_new()
296 if c == nil {
297 return nil, nilPtrErr
298 }
299 return wrapStackSidebar(glib.Take(unsafe.Pointer(c))), nil
300 }
301
302 // SetStack is a wrapper around gtk_stack_sidebar_set_stack().
303 func (v *StackSidebar) SetStack(stack *Stack) {
304 C.gtk_stack_sidebar_set_stack(v.native(), stack.native())
305 }
306
307 // GetStack is a wrapper around gtk_stack_sidebar_get_stack().
308 func (v *StackSidebar) GetStack() *Stack {
309 c := C.gtk_stack_sidebar_get_stack(v.native())
310 if c == nil {
311 return nil
312 }
313 return wrapStack(glib.Take(unsafe.Pointer(c)))
314 }
315
316 /*
317 * GtkEntry
318 */
319
320 // GrabFocusWithoutSelecting is a wrapper for gtk_entry_grab_focus_without_selecting()
321 func (v *Entry) GrabFocusWithoutSelecting() {
322 C.gtk_entry_grab_focus_without_selecting(v.native())
323 }
324
325 /*
326 * GtkSearchEntry
327 */
328
329 // HandleEvent is a wrapper around gtk_search_entry_handle_event().
330 func (v *SearchEntry) HandleEvent(event *gdk.Event) {
331 e := (*C.GdkEvent)(unsafe.Pointer(event.Native()))
332 C.gtk_search_entry_handle_event(v.native(), e)
333 }
334
335 /*
336 * GtkTextBuffer
337 */
338
339 // InsertMarkup is a wrapper around gtk_text_buffer_insert_markup()
340 func (v *TextBuffer) InsertMarkup(start *TextIter, text string) {
341 cstr := C.CString(text)
342 defer C.free(unsafe.Pointer(cstr))
343 C.gtk_text_buffer_insert_markup(v.native(), (*C.GtkTextIter)(start), (*C.gchar)(cstr), C.gint(len(text)))
344 }
345
346 /*
347 * CssProvider
348 */
349
350 // LoadFromResource is a wrapper around gtk_css_provider_load_from_resource().
351 //
352 // See: https://developer.gnome.org/gtk3/stable/GtkCssProvider.html#gtk-css-provider-load-from-resource
353 func (v *CssProvider) LoadFromResource(path string) {
354 cpath := C.CString(path)
355 defer C.free(unsafe.Pointer(cpath))
356 C.gtk_css_provider_load_from_resource(v.native(), (*C.gchar)(cpath))
357 }
358
359 /*
360 * GtkTextView
361 */
362
363 // SetMonospace is a wrapper around gtk_text_view_set_monospace()
364 func (v *TextView) SetMonospace(monospace bool) {
365 C.gtk_text_view_set_monospace(v.native(), gbool(monospace))
366 }
367
368 // GetMonospace is a wrapper around gtk_text_view_get_monospace()
369 func (v *TextView) GetMonospace() bool {
370 return gobool(C.gtk_text_view_get_monospace(v.native()))
371 }