Debian Codegraph @

gtk/gtk_since_3_22.go

raw symbols SCIP
1 // +build !gtk_3_6,!gtk_3_8,!gtk_3_10,!gtk_3_12,!gtk_3_14,!gtk_3_16,!gtk_3_18,!gtk_3_20
2
3 // See: https://developer.gnome.org/gtk3/3.22/api-index-3-22.html
4
5 package gtk
6
7 // #include <gtk/gtk.h>
8 // #include "gtk.go.h"
9 import "C"
10 import (
11 "unsafe"
12 )
13
14 // Popup is a wrapper around gtk_popover_popup().
15 func (v *Popover) Popup() {
16 C.gtk_popover_popup(v.native())
17 }
18
19 // Popdown is a wrapper around gtk_popover_popdown().
20 func (v *Popover) Popdown() {
21 C.gtk_popover_popdown(v.native())
22 }
23
24 /*
25 * GtkFileChooser
26 */
27
28 // AddChoice is a wrapper around gtk_file_chooser_add_choice().
29 func (v *FileChooser) AddChoice(id, label string, options, optionLabels []string) {
30 cId := C.CString(id)
31 defer C.free(unsafe.Pointer(cId))
32
33 cLabel := C.CString(label)
34 defer C.free(unsafe.Pointer(cLabel))
35
36 if options == nil || optionLabels == nil {
37 C.gtk_file_chooser_add_choice(v.native(), (*C.gchar)(cId), (*C.gchar)(cLabel), nil, nil)
38 return
39 }
40
41 cOptions := C.make_strings(C.int(len(options) + 1))
42 for i, option := range options {
43 cstr := C.CString(option)
44 defer C.free(unsafe.Pointer(cstr))
45 C.set_string(cOptions, C.int(i), (*C.gchar)(cstr))
46 }
47 C.set_string(cOptions, C.int(len(options)), nil)
48
49 cOptionLabels := C.make_strings(C.int(len(optionLabels) + 1))
50 for i, optionLabel := range optionLabels {
51 cstr := C.CString(optionLabel)
52 defer C.free(unsafe.Pointer(cstr))
53 C.set_string(cOptionLabels, C.int(i), (*C.gchar)(cstr))
54 }
55 C.set_string(cOptionLabels, C.int(len(optionLabels)), nil)
56
57 C.gtk_file_chooser_add_choice(v.native(), (*C.gchar)(cId), (*C.gchar)(cLabel), cOptions, cOptionLabels)
58 }
59
60 // RemoveChoice is a wrapper around gtk_file_chooser_remove_choice().
61 func (v *FileChooser) RemoveChoice(id string) {
62 cId := C.CString(id)
63 defer C.free(unsafe.Pointer(cId))
64 C.gtk_file_chooser_remove_choice(v.native(), (*C.gchar)(cId))
65 }
66
67 // SetChoice is a wrapper around gtk_file_chooser_set_choice().
68 func (v *FileChooser) SetChoice(id, option string) {
69 cId := C.CString(id)
70 defer C.free(unsafe.Pointer(cId))
71 cOption := C.CString(option)
72 defer C.free(unsafe.Pointer(cOption))
73 C.gtk_file_chooser_set_choice(v.native(), (*C.gchar)(cId), (*C.gchar)(cOption))
74 }
75
76 // GetChoice is a wrapper around gtk_file_chooser_get_choice().
77 func (v *FileChooser) GetChoice(id string) string {
78 cId := C.CString(id)
79 defer C.free(unsafe.Pointer(cId))
80 c := C.gtk_file_chooser_get_choice(v.native(), (*C.gchar)(cId))
81 return C.GoString(c)
82 }
83
84 /*
85 * GtkScrolledWindow
86 */
87
88 // GetMaxContentWidth is a wrapper around gtk_scrolled_window_get_max_content_width().
89 func (v *ScrolledWindow) GetMaxContentWidth() int {
90 c := C.gtk_scrolled_window_get_max_content_width(v.native())
91 return int(c)
92 }
93
94 // SetMaxContentWidth is a wrapper around gtk_scrolled_window_set_max_content_width().
95 func (v *ScrolledWindow) SetMaxContentWidth(width int) {
96 C.gtk_scrolled_window_set_max_content_width(v.native(), C.gint(width))
97 }
98
99 // GetMaxContentHeight is a wrapper around gtk_scrolled_window_get_max_content_height().
100 func (v *ScrolledWindow) GetMaxContentHeight() int {
101 c := C.gtk_scrolled_window_get_max_content_height(v.native())
102 return int(c)
103 }
104
105 // SetMaxContentHeight is a wrapper around gtk_scrolled_window_set_max_content_height().
106 func (v *ScrolledWindow) SetMaxContentHeight(width int) {
107 C.gtk_scrolled_window_set_max_content_height(v.native(), C.gint(width))
108 }
109
110 // GetPropagateNaturalWidth is a wrapper around gtk_scrolled_window_get_propagate_natural_width().
111 func (v *ScrolledWindow) GetPropagateNaturalWidth() bool {
112 c := C.gtk_scrolled_window_get_propagate_natural_width(v.native())
113 return gobool(c)
114 }
115
116 // SetPropagateNaturalWidth is a wrapper around gtk_scrolled_window_set_propagate_natural_width().
117 func (v *ScrolledWindow) SetPropagateNaturalWidth(propagate bool) {
118 C.gtk_scrolled_window_set_propagate_natural_width(v.native(), gbool(propagate))
119 }
120
121 // GetPropagateNaturalHeight is a wrapper around gtk_scrolled_window_get_propagate_natural_height().
122 func (v *ScrolledWindow) GetPropagateNaturalHeight() bool {
123 c := C.gtk_scrolled_window_get_propagate_natural_height(v.native())
124 return gobool(c)
125 }
126
127 // SetPropagateNaturalHeight is a wrapper around gtk_scrolled_window_set_propagate_natural_height().
128 func (v *ScrolledWindow) SetPropagateNaturalHeight(propagate bool) {
129 C.gtk_scrolled_window_set_propagate_natural_height(v.native(), gbool(propagate))
130 }