diff options
Diffstat (limited to 'plugins/MirLua/docs/examples')
-rw-r--r-- | plugins/MirLua/docs/examples/core.lua | 22 | ||||
-rw-r--r-- | plugins/MirLua/docs/examples/database.lua | 49 | ||||
-rw-r--r-- | plugins/MirLua/docs/examples/icons.lua | 22 | ||||
-rw-r--r-- | plugins/MirLua/docs/examples/menus.lua | 66 | ||||
-rw-r--r-- | plugins/MirLua/docs/examples/msgbuttonsbar.lua | 36 | ||||
-rw-r--r-- | plugins/MirLua/docs/examples/popup.lua | 28 | ||||
-rw-r--r-- | plugins/MirLua/docs/examples/toptoolbar.lua | 43 | ||||
-rw-r--r-- | plugins/MirLua/docs/examples/variables.lua | 3 |
8 files changed, 0 insertions, 269 deletions
diff --git a/plugins/MirLua/docs/examples/core.lua b/plugins/MirLua/docs/examples/core.lua deleted file mode 100644 index d72ce0c18f..0000000000 --- a/plugins/MirLua/docs/examples/core.lua +++ /dev/null @@ -1,22 +0,0 @@ --- core module (m) is included by default ---- 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') - --- Add icon for menu items -local hRestartIcon = icolib.AddIcon('restartIcon', 'Restart') - --- Subscribe to Lua script loaded event -m.OnScriptLoaded(function() - -- Add menu item to main menu that allow to restart Miranda NG - hRestartMenuItem = clist.AddMainMenuItem({ Name = "Restart", Icon = hRestartIcon, Service = "Miranda/System/Restart" }) -end) - --- Subscribe to Lua script unload event -m.OnScriptUnload(function() - -- remove menu item from main menu - hRestartMenuItem = genmenu.RemoveMenuItem(hRestart) -end) diff --git a/plugins/MirLua/docs/examples/database.lua b/plugins/MirLua/docs/examples/database.lua deleted file mode 100644 index 033293e5c7..0000000000 --- a/plugins/MirLua/docs/examples/database.lua +++ /dev/null @@ -1,49 +0,0 @@ ---- include m_database module -local db = require('m_database') - ---- Iterate all contact stored in db --- @param protoName The name of protocol account or nothing -for hContact in db.AllContacts() do - --print(hContact) -end - -local hContact = 15 - ---- Iterate all contact events stored in db --- param hContact The handle of contact -for hEvent in db.AllEvents(hContact) do - --print(hEvent) -end - ---- Iterate all setting names stored in db --- param module The name of module --- param hContact The handle of contact or nothing -for setting in db.AllSettings('CList') do - --print(setting) -end - ---- Save value to database --- @param hContact The handle of contact (can be NULL) --- @param module The name of section --- @param setting The name of setting --- @return value The value -db.WriteSetting(nil, 'MirLua', 'testNum', -2342) - ---- Return value from database --- @param hContact The handle of contact (can be NULL) --- @param module The name of section --- @param setting The name of setting --- @param default The value which will be returned if setting doesn't not exists -local bValue = db.GetSetting(nil, 'MirLua', 'testByte'); - --- print string value if bool value is true -if bValue then - local sValue = db.GetSetting(nil, 'MirLua', 'testString', 'Hello!') - print(sValue) - end - ---- Delete value from database --- @param hContact The handle of contact (can be NULL) --- @param module The name of section --- @param setting The name of setting -db.DeleteSetting(nil, 'MirLua', 'testNum'); diff --git a/plugins/MirLua/docs/examples/icons.lua b/plugins/MirLua/docs/examples/icons.lua deleted file mode 100644 index 4d54cb8e8b..0000000000 --- a/plugins/MirLua/docs/examples/icons.lua +++ /dev/null @@ -1,22 +0,0 @@ ---- include m_icolib module -local icolib = require('m_icolib') - ---- Add icon to icoLib --- @param name The name of icon --- @param description The description of icon --- @param section The section in witch icon will be stored (default 'MirLua') --- @return handle of icon -icolib.AddIcon('testIcon', 'Lua icon', 'MirLua') - ---- Create the icon which will be deleted below -icolib.AddIcon('testRemoved', 'Lua temporary icon') - ---- Get icon by name --- @param name The name of icon --- @return handle of icon -local hIcon = icolib.GetIcon('testRemoved') - ---- Remove icon from iconLib --- @param handle The handle of icon (or name) --- @return 0 on success -icolib.RemoveIcon('testRemoved') diff --git a/plugins/MirLua/docs/examples/menus.lua b/plugins/MirLua/docs/examples/menus.lua deleted file mode 100644 index b3de5e5d64..0000000000 --- a/plugins/MirLua/docs/examples/menus.lua +++ /dev/null @@ -1,66 +0,0 @@ ---- 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 hRoot = clist.AddMainMenuItem({ Name = "Main menu root" }) - ---- Add child menu item -menuItem.Name = "Main menu child wierd" -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) diff --git a/plugins/MirLua/docs/examples/msgbuttonsbar.lua b/plugins/MirLua/docs/examples/msgbuttonsbar.lua deleted file mode 100644 index d69ee9078a..0000000000 --- a/plugins/MirLua/docs/examples/msgbuttonsbar.lua +++ /dev/null @@ -1,36 +0,0 @@ ---- include m_msg_buttonsbar module -local mbb = require('m_msg_buttonsbar') ---- include m_icolib module -local icolib = require('m_icolib') - -local BBBF_ISIMBUTTON = 32 -local BBBF_ISLSIDEBUTTON = 64 - -local bbButton = -{ - -- required fields - Module = "MirLua", - ButtonID = 1, - - Flags = BBBF_ISIMBUTTON | BBBF_ISLSIDEBUTTON, - Tooltip = "Msg button", - Icon = icolib.AddIcon('testBBBIcon', 'Lua icon for bbbButton') -} - ---- Add button on msg buttons bar -mbb.AddButton(bbButton) - ---- Create the msg buttons bar button which will be deleted below -mbb.AddButton({ - Module = "MirLua", - ButtonID = 2, - Flags = BBBF_ISIMBUTTON | BBBF_ISLSIDEBUTTON, - Tooltip = "Msg button for deletion" - }) - -mbb.OnMsgToolBarButtonPressed(function(w, l) - if l.Module == "MirLua" and l.ButtonID == 1 then - --- Remove button from msg buttons bar - mbb.RemoveButton("MirLua", 2) - end -end) diff --git a/plugins/MirLua/docs/examples/popup.lua b/plugins/MirLua/docs/examples/popup.lua deleted file mode 100644 index 172b98ea59..0000000000 --- a/plugins/MirLua/docs/examples/popup.lua +++ /dev/null @@ -1,28 +0,0 @@ ---- include m_popup module -local popup = require('m_popup') ---- include m_clist module -local clist = require('m_clist') - -m.CreateServiceFunction('MirLua/ShowPopup', function() - local popupData = - { - ContactName = 'Contact', - Text = 'Popup content', - hContact = 0 - } - popup.AddPopup(popupData) -end) - -m.CreateServiceFunction('MirLua/ShowPopup2', function() - local popupData = - { - Title = 'Title', - Text = 'Popup content', - hContact = 0, - Flags = 1 - } - popup.AddPopup2(popupData) -end) - -clist.AddMainMenuItem({ Name = "Show lua popup", Service = 'MirLua/ShowPopup' }) -clist.AddMainMenuItem({ Name = "Show lua popup2", Service = 'MirLua/ShowPopup2' }) diff --git a/plugins/MirLua/docs/examples/toptoolbar.lua b/plugins/MirLua/docs/examples/toptoolbar.lua deleted file mode 100644 index 85a3a3a97b..0000000000 --- a/plugins/MirLua/docs/examples/toptoolbar.lua +++ /dev/null @@ -1,43 +0,0 @@ ---- include m_toptoolbar module -local ttb = require('m_toptoolbar') ---- include m_icolib module -local icolib = require('m_icolib') - -local TTBBF_VISIBLE = tonumber("0002", 16) - -local ttbButton = -{ - -- required field - Name = "MirLua", - - Service = nil, - Flags = TTBBF_VISIBLE, - - IconUp = nil, - TooltipUp = "Up state", - wParamUp = nil, - lParamUp = nil, - - IconDown = nil, - TooltipDown = "Down state", - wParamDown = nil, - lParamDown = nil -} - ---- Add icons for top toolbar -ttbButton.IconUp = icolib.AddIcon('testTTBIconUp', 'Lua icon for ttbButtonUp') -ttbButton.IconDown = icolib.AddIcon('testTTBIconDn', 'Lua icon for ttbButtonUp') - ---- Add button on top toolbar -ttb.Service = "Srv/TTB" -ttb.AddButton(ttbButton) - ---- Create the top toolbar button which will be deleted below -local hTTButton = ttb.AddButton({ - Name = "MirLua", - TooltipUp = "Up state to delete", - TooltipDown = "Down state to delete" - }) - ---- Remove button from top toolbar -ttb.RemoveButton(hTTButton) diff --git a/plugins/MirLua/docs/examples/variables.lua b/plugins/MirLua/docs/examples/variables.lua deleted file mode 100644 index 422c8b88bb..0000000000 --- a/plugins/MirLua/docs/examples/variables.lua +++ /dev/null @@ -1,3 +0,0 @@ -local vars = require('m_variables') - -print(vars.FormatString('?add(2,2)')) |