Plugin:MirLua/Module/m genmenu

From Miranda NG
< Plugin:MirLua
Revision as of 21:16, 16 December 2015 by Unsane (talk | contribs) (Fixed link)
Jump to navigation Jump to search

Allows you to access menu subsystem.

Include module: local genmenu = require('m_genmenu')

<translate> Note</translate>
Parameters written in bold italics are obligatory.


Constants

MO_MAIN

Main menu.

Type: number

MO_CONTACT

Contact menu.

Type: number


Functions

CreateRoot

Creates root menu item.

Parameters
hMenuObject
Type: number
Global menu handle.
name
Type: string
Menu item name.
position
Type: number
Menu item position.
icon
Type: light userdata
Icon handle.
Result
Type: light userdata
If success, returns menu item handle, otherwise nil.
Example
local hMenuItem = genmenu.CreateRoot(genmenu.MO_MAIN)

AddMenuItem

Creates menu item.

Parameters
hMenuObject
Type: number
Global menu handle.
menuItem
Type: table
MenuItem table.
Result
Type: light userdata
If success, returns menu item handle, otherwise nil.
Example
local hMenuItem = genmenu.AddMenuItem(genmenu.MO_MAIN, { Name = 'MyMenuItem'})

ModifyMenuItem

Modifies menu item.

Parameters
hMenuItem
Type: light userdata
Menu item handle.
name
Type: string
New menu item name or nil.
icon
Type: light userdata
Icon handle or INVALID_HANDLE_VALUE
flags
Type: number
Additional flags or -1
Result
Type: light userdata
If success, returns menu item handle, otherwise nil.
Example
local hMenuItem = genmenu.CreateRoot(genmenu.MO_MAIN)

ShowMenuItem

Shows/hides menu item.

Parameters
hMenuItem
Type: light userdata
Menu item handle.
isShown
Type: boolean
true to show menu item, false to hide it.
Example
genmenu.ShowMenuItem(hMenuItem, true)

EnableMenuItem

Enables/disables menu item.

Parameters
hMenuItem
Type: light userdata
Menu item handle.
isEnabled
Type: boolean
true to enable menu item, false to disable it.
Example
genmenu.EnableMenuItem(hMenuItem, false)

CheckMenuItem

Checks/unchecks menu item.

Parameters
hMenuItem
Type: light userdata
Menu item handle.
isChecked
Type: boolean
true to enable menu item, false to disable it.
Example
genmenu.CheckMenuItem(hMenuItem, true)

RemoveMenuItem

Removes menu item.

Parameters
hMenuItem
Type: light userdata
Menu item handle.
Result
Type: boolean
If success, returns menu item handle, otherwise nil.
Example
genmenu.RemoveMenuItem(hMenuItem)


Structures

MenuItem

A table describing menu parameters.

Fields
Name
Type: string
Menu item name (automatically translated by Core).
Uid
Type: string
Plugin UUID in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
Service
Type: string
Function name.
Position
Type: number
Menu item position.
Parent
Type: light userdata
Parent menu handle.
Icon
Type: light userdata
Icon handle.
Flags
Type: number
Additional flags.