| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
package gtk |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
import "C" |
| 10 |
import ( |
| 11 |
"unsafe" |
| 12 |
) |
| 13 |
|
| 14 |
|
| 15 |
func (v *Popover) Popup() { |
| 16 |
C.gtk_popover_popup(v.native()) |
| 17 |
} |
| 18 |
|
| 19 |
|
| 20 |
func (v *Popover) Popdown() { |
| 21 |
C.gtk_popover_popdown(v.native()) |
| 22 |
} |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 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 |
|
| 95 |
func (v *ScrolledWindow) SetMaxContentWidth(width int) { |
| 96 |
C.gtk_scrolled_window_set_max_content_width(v.native(), C.gint(width)) |
| 97 |
} |
| 98 |
|
| 99 |
|
| 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 |
|
| 106 |
func (v *ScrolledWindow) SetMaxContentHeight(width int) { |
| 107 |
C.gtk_scrolled_window_set_max_content_height(v.native(), C.gint(width)) |
| 108 |
} |
| 109 |
|
| 110 |
|
| 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 |
|
| 117 |
func (v *ScrolledWindow) SetPropagateNaturalWidth(propagate bool) { |
| 118 |
C.gtk_scrolled_window_set_propagate_natural_width(v.native(), gbool(propagate)) |
| 119 |
} |
| 120 |
|
| 121 |
|
| 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 |
|
| 128 |
func (v *ScrolledWindow) SetPropagateNaturalHeight(propagate bool) { |
| 129 |
C.gtk_scrolled_window_set_propagate_natural_height(v.native(), gbool(propagate)) |
| 130 |
} |