mirror of https://github.com/subgraph/fw-daemon
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
97 lines
2.7 KiB
97 lines
2.7 KiB
8 years ago
|
// Same copyright and license as the rest of the files in this project
|
||
|
// This file contains accelerator related functions and structures
|
||
|
|
||
|
package gtk
|
||
|
|
||
|
// #include <gtk/gtk.h>
|
||
|
// #include "gtk.go.h"
|
||
|
import "C"
|
||
|
import (
|
||
|
"unsafe"
|
||
|
|
||
|
"github.com/gotk3/gotk3/glib"
|
||
|
)
|
||
|
|
||
|
/*
|
||
|
* GtkMenuShell
|
||
|
*/
|
||
|
|
||
|
// MenuShell is a representation of GTK's GtkMenuShell.
|
||
|
type MenuShell struct {
|
||
|
Container
|
||
|
}
|
||
|
|
||
|
// native returns a pointer to the underlying GtkMenuShell.
|
||
|
func (v *MenuShell) native() *C.GtkMenuShell {
|
||
|
if v == nil || v.GObject == nil {
|
||
|
return nil
|
||
|
}
|
||
|
p := unsafe.Pointer(v.GObject)
|
||
|
return C.toGtkMenuShell(p)
|
||
|
}
|
||
|
|
||
|
func marshalMenuShell(p uintptr) (interface{}, error) {
|
||
|
c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p)))
|
||
|
obj := wrapObject(unsafe.Pointer(c))
|
||
|
return wrapMenuShell(obj), nil
|
||
|
}
|
||
|
|
||
|
func wrapMenuShell(obj *glib.Object) *MenuShell {
|
||
|
return &MenuShell{Container{Widget{glib.InitiallyUnowned{obj}}}}
|
||
|
}
|
||
|
|
||
|
// Append is a wrapper around gtk_menu_shell_append().
|
||
|
func (v *MenuShell) Append(child IMenuItem) {
|
||
|
C.gtk_menu_shell_append(v.native(), child.toWidget())
|
||
|
}
|
||
|
|
||
|
// Prepend is a wrapper around gtk_menu_shell_prepend().
|
||
|
func (v *MenuShell) Prepend(child IMenuItem) {
|
||
|
C.gtk_menu_shell_prepend(v.native(), child.toWidget())
|
||
|
}
|
||
|
|
||
|
// Insert is a wrapper around gtk_menu_shell_insert().
|
||
|
func (v *MenuShell) Insert(child IMenuItem, position int) {
|
||
|
C.gtk_menu_shell_insert(v.native(), child.toWidget(), C.gint(position))
|
||
|
}
|
||
|
|
||
|
// Deactivate is a wrapper around gtk_menu_shell_deactivate().
|
||
|
func (v *MenuShell) Deactivate() {
|
||
|
C.gtk_menu_shell_deactivate(v.native())
|
||
|
}
|
||
|
|
||
|
// SelectItem is a wrapper around gtk_menu_shell_select_item().
|
||
|
func (v *MenuShell) SelectItem(child IMenuItem) {
|
||
|
C.gtk_menu_shell_select_item(v.native(), child.toWidget())
|
||
|
}
|
||
|
|
||
|
// SelectFirst is a wrapper around gtk_menu_shell_select_first().
|
||
|
func (v *MenuShell) SelectFirst(searchSensitive bool) {
|
||
|
C.gtk_menu_shell_select_first(v.native(), gbool(searchSensitive))
|
||
|
}
|
||
|
|
||
|
// Deselect is a wrapper around gtk_menu_shell_deselect().
|
||
|
func (v *MenuShell) Deselect() {
|
||
|
C.gtk_menu_shell_deselect(v.native())
|
||
|
}
|
||
|
|
||
|
// ActivateItem is a wrapper around gtk_menu_shell_activate_item().
|
||
|
func (v *MenuShell) ActivateItem(child IMenuItem, forceDeactivate bool) {
|
||
|
C.gtk_menu_shell_activate_item(v.native(), child.toWidget(), gbool(forceDeactivate))
|
||
|
}
|
||
|
|
||
|
// Cancel is a wrapper around gtk_menu_shell_cancel().
|
||
|
func (v *MenuShell) Cancel() {
|
||
|
C.gtk_menu_shell_cancel(v.native())
|
||
|
}
|
||
|
|
||
|
// SetTakeFocus is a wrapper around gtk_menu_shell_set_take_focus().
|
||
|
func (v *MenuShell) SetTakeFocus(takeFocus bool) {
|
||
|
C.gtk_menu_shell_set_take_focus(v.native(), gbool(takeFocus))
|
||
|
}
|
||
|
|
||
|
// gboolean gtk_menu_shell_get_take_focus ()
|
||
|
// GtkWidget * gtk_menu_shell_get_selected_item ()
|
||
|
// GtkWidget * gtk_menu_shell_get_parent_shell ()
|
||
|
// void gtk_menu_shell_bind_model ()
|