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 gtk_deprecated
2
3package gtk
4
5// #include <gtk/gtk.h>
6// #include <stdlib.h>
7import "C"
8
9import (
10	"unsafe"
11
12	"github.com/gotk3/gotk3/gdk"
13)
14
15/*
16 * GtkWidget
17 */
18
19// TODO:
20// gtk_widget_send_expose().
21// gtk_widget_is_composited().
22
23// PopupAtMouse() is a wrapper for gtk_menu_popup(), without the option for a custom positioning function.
24func (v *Menu) PopupAtMouseCursor(parentMenuShell IMenu, parentMenuItem IMenuItem, button gdk.Button, activateTime uint32) {
25	wshell := nullableWidget(parentMenuShell)
26	witem := nullableWidget(parentMenuItem)
27
28	C.gtk_menu_popup(v.native(),
29		wshell,
30		witem,
31		nil,
32		nil,
33		C.guint(button),
34		C.guint32(activateTime))
35}
36
37func (v *SizeGroup) GetIgnoreHidden() bool {
38	c := C.gtk_size_group_get_ignore_hidden(v.native())
39	return gobool(c)
40}
41
42// SetWMClass is a wrapper around gtk_window_set_wmclass().
43func (v *Window) SetWMClass(name, class string) {
44	cName := C.CString(name)
45	defer C.free(unsafe.Pointer(cName))
46	cClass := C.CString(class)
47	defer C.free(unsafe.Pointer(cClass))
48	C.gtk_window_set_wmclass(v.native(), (*C.gchar)(cName), (*C.gchar)(cClass))
49}
50
51func (v *SizeGroup) SetIgnoreHidden(ignoreHidden bool) {
52	C.gtk_size_group_set_ignore_hidden(v.native(), gbool(ignoreHidden))
53}
54
55// GetFontName is a wrapper around gtk_font_button_get_font_name().
56func (v *FontButton) GetFontName() string {
57	c := C.gtk_font_button_get_font_name(v.native())
58	return goString(c)
59}
60
61// SetFontName is a wrapper around gtk_font_button_set_font_name().
62func (v *FontButton) SetFontName(fontname string) bool {
63	cstr := C.CString(fontname)
64	defer C.free(unsafe.Pointer(cstr))
65	c := C.gtk_font_button_set_font_name(v.native(), (*C.gchar)(cstr))
66	return gobool(c)
67}
68