File: menu.go

package info (click to toggle)
golang-github-twstrike-gotk3adapter 0.0~git20170505.0.901a95d%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,232 kB
  • sloc: ruby: 478; makefile: 4
file content (46 lines) | stat: -rw-r--r-- 937 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package gtka

import (
	"github.com/gotk3/gotk3/gtk"
	"github.com/twstrike/gotk3adapter/gdka"
	"github.com/twstrike/gotk3adapter/gdki"
	"github.com/twstrike/gotk3adapter/gtki"
)

type menu struct {
	*menuShell
	internal *gtk.Menu
}

func wrapMenuSimple(v *gtk.Menu) *menu {
	if v == nil {
		return nil
	}
	return &menu{wrapMenuShellSimple(&v.MenuShell), v}
}

func wrapMenu(v *gtk.Menu, e error) (*menu, error) {
	return wrapMenuSimple(v), e
}

func unwrapMenu(v gtki.Menu) *gtk.Menu {
	if v == nil {
		return nil
	}
	return v.(*menu).internal
}

func unwrapMenuToIMenu(v gtki.Menu) gtk.IMenu {
	if v == nil {
		return nil
	}
	return v.(*menu).internal
}

func (v *menu) PopupAtMouseCursor(v1 gtki.Menu, v2 gtki.MenuItem, v3 int, v4 uint32) {
	v.internal.PopupAtMouseCursor(unwrapMenuToIMenu(v1), unwrapMenuItemToIMenuItem(v2), v3, v4)
}

func (v *menu) PopupAtPointer(v1 gdki.Event) {
	v.internal.PopupAtPointer(gdka.UnwrapEvent(v1))
}