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
|
--- include m_clist module
local clist = require('m_clist')
--- include m_genmenu module
local genmenu = require('m_genmenu')
--- include m_icolib module
local icolib = require('m_icolib')
local menuItem =
{
-- required field
Name = "Menu item",
Flags = 0,
Position = 0,
Icon = nil,
Service = nil,
Parent = nil
}
--- Add icon for menu items
local hIcon = icolib.AddIcon('testMenuIcon', 'Lua icon for menus')
--- Add menu item to main menu
menuItem.Name = "Main menu item"
menuItem.Icon = hIcon
menuItem.Service = "Srv/MMI"
clist.AddMainMenuItem(menuItem)
--- Add menu item to main menu
menuItem.Name = "Tray menu item"
menuItem.Service = "Srv/TMI"
clist.AddTrayMenuItem(menuItem)
--- Add menu item to contact menu
menuItem.Name = "Contact menu item"
menuItem.Service = "Srv/CMI"
clist.AddContactMenuItem(menuItem)
--- Create the contact menu item which will be deleted below
menuItem.Name = "testRemove"
menuItem.Service = "Srv/TestRemove"
local hMenuItem = clist.AddContactMenuItem(menuItem)
--- Remove menu item from parent menu
genmenu.RemoveMenuItem(hMenuItem)
--- Add root menu item
local CMIF_ROOTHANDLE = 384
local hRoot = clist.AddMainMenuItem({ Name = "Main menu root", Flags = CMIF_ROOTHANDLE })
--- Add child menu item
menuItem.Name = "Main menu child wierd"
menuItem.Flags = CMIF_ROOTHANDLE
menuItem.Service = 'Srv/SMI'
menuItem.Parent = hRoot
local hChild = clist.AddMainMenuItem(menuItem)
--- Modify menu item
local CMIM_NAME = tonumber("80000000", 16)
genmenu.ModifyMenuItem(hChild, "Main menu child", hIcon, CMIM_NAME)
local hDisabledMenuItem = clist.AddMainMenuItem({ Name = "Disabled main menu item" })
genmenu.EnableMenuItem(hDisabledMenuItem, false)
local hHiddenMenuItem = clist.AddMainMenuItem({ Name = "Hidden main menu item" })
genmenu.ShowMenuItem(hHiddenMenuItem, false)
local hCheckedMenuItem = clist.AddMainMenuItem({ Name = "Checked main menu item" })
genmenu.CheckMenuItem(hCheckedMenuItem, true)
|