summaryrefslogtreecommitdiffstatshomepage
path: root/menu.go
blob: c9dad192d3d8cdfe4d1cfc3f68710afa6573a1d4 (plain) (blame)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
// Copyright 2010 The win Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build windows

package win

// Constants for MENUITEMINFO.fMask
const (
	MIIM_STATE      = 1
	MIIM_ID         = 2
	MIIM_SUBMENU    = 4
	MIIM_CHECKMARKS = 8
	MIIM_TYPE       = 16
	MIIM_DATA       = 32
	MIIM_STRING     = 64
	MIIM_BITMAP     = 128
	MIIM_FTYPE      = 256
)

// Constants for MENUITEMINFO.fType
const (
	MFT_STRING       = MF_STRING
	MFT_BITMAP       = MF_BITMAP
	MFT_MENUBARBREAK = MF_MENUBARBREAK
	MFT_MENUBREAK    = MF_MENUBREAK
	MFT_OWNERDRAW    = MF_OWNERDRAW
	MFT_RADIOCHECK   = 0x00000200
	MFT_SEPARATOR    = MF_SEPARATOR
	MFT_RIGHTORDER   = 0x00002000
	MFT_RIGHTJUSTIFY = MF_RIGHTJUSTIFY
)

// Constants for MENUITEMINFO.fState
const (
	MFS_GRAYED    = 0x00000003
	MFS_DISABLED  = MFS_GRAYED
	MFS_CHECKED   = MF_CHECKED
	MFS_HILITE    = MF_HILITE
	MFS_ENABLED   = MF_ENABLED
	MFS_UNCHECKED = MF_UNCHECKED
	MFS_UNHILITE  = MF_UNHILITE
	MFS_DEFAULT   = MF_DEFAULT
)

// Constants for MENUITEMINFO.hbmp*
const (
	HBMMENU_CALLBACK        = -1
	HBMMENU_SYSTEM          = 1
	HBMMENU_MBAR_RESTORE    = 2
	HBMMENU_MBAR_MINIMIZE   = 3
	HBMMENU_MBAR_CLOSE      = 5
	HBMMENU_MBAR_CLOSE_D    = 6
	HBMMENU_MBAR_MINIMIZE_D = 7
	HBMMENU_POPUP_CLOSE     = 8
	HBMMENU_POPUP_RESTORE   = 9
	HBMMENU_POPUP_MAXIMIZE  = 10
	HBMMENU_POPUP_MINIMIZE  = 11
)

// MENUINFO mask constants
const (
	MIM_APPLYTOSUBMENUS = 0x80000000
	MIM_BACKGROUND      = 0x00000002
	MIM_HELPID          = 0x00000004
	MIM_MAXHEIGHT       = 0x00000001
	MIM_MENUDATA        = 0x00000008
	MIM_STYLE           = 0x00000010
)

// MENUINFO style constants
const (
	MNS_AUTODISMISS = 0x10000000
	MNS_CHECKORBMP  = 0x04000000
	MNS_DRAGDROP    = 0x20000000
	MNS_MODELESS    = 0x40000000
	MNS_NOCHECK     = 0x80000000
	MNS_NOTIFYBYPOS = 0x08000000
)

const (
	// Menu flags for Add/Check/EnableMenuItem()
	MF_INSERT = 0x00000000
	MF_CHANGE = 0x00000080
	MF_APPEND = 0x00000100
	MF_DELETE = 0x00000200
	MF_REMOVE = 0x00001000

	MF_BYCOMMAND  = 0x00000000
	MF_BYPOSITION = 0x00000400

	MF_SEPARATOR = 0x00000800

	MF_ENABLED  = 0x00000000
	MF_GRAYED   = 0x00000001
	MF_DISABLED = 0x00000002

	MF_UNCHECKED       = 0x00000000
	MF_CHECKED         = 0x00000008
	MF_USECHECKBITMAPS = 0x00000200

	MF_STRING    = 0x00000000
	MF_BITMAP    = 0x00000004
	MF_OWNERDRAW = 0x00000100

	MF_POPUP        = 0x00000010
	MF_MENUBARBREAK = 0x00000020
	MF_MENUBREAK    = 0x00000040

	MF_UNHILITE = 0x00000000
	MF_HILITE   = 0x00000080

	MF_DEFAULT      = 0x00001000
	MF_SYSMENU      = 0x00002000
	MF_HELP         = 0x00004000
	MF_RIGHTJUSTIFY = 0x00004000

	MF_MOUSESELECT = 0x00008000
)

type MENUITEMINFO struct {
	CbSize        uint32
	FMask         uint32
	FType         uint32
	FState        uint32
	WID           uint32
	HSubMenu      HMENU
	HbmpChecked   HBITMAP
	HbmpUnchecked HBITMAP
	DwItemData    uintptr
	DwTypeData    *uint16
	Cch           uint32
	HbmpItem      HBITMAP
}

type MENUINFO struct {
	CbSize          uint32
	FMask           uint32
	DwStyle         uint32
	CyMax           uint32
	HbrBack         HBRUSH
	DwContextHelpID uint32
	DwMenuData      uintptr
}