• skip to content

Wiki

User Tools

  • Admin
  • Log In

Site Tools

  • Recent Changes
  • Media Manager
  • Sitemap
Trace:

dev:v3:gui_api:menu:menu

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
dev:v3:gui_api:menu:menu [2020/07/06 06:04] – created jedi18dev:v3:gui_api:menu:menu [2020/07/07 04:18] (current) – jedi18
Line 1: Line 1:
-====== Menu GUI Class ====== +====== Menu Item GUI Class ====== 
-[[https://github.com/LibreCAD/LibreCAD_3/blob/master/lcUI/widgets/guiAPI/menu.h|Github Link]]+[[https://github.com/LibreCAD/LibreCAD_3/blob/master/lcUI/widgets/guiAPI/menuitem.h|Github Link]]
 <code cpp-qt> namespace lc::ui::api </code> <code cpp-qt> namespace lc::ui::api </code>
 ---- ----
  
 +===== Menu Item Constructor =====
  
 +----
 +
 +==== Description ====
 +
 +Constructs a menu item gui object. Menu item after being constructed needs to be added to a menu for it to be visible in the application.
 +
 +  * Menu Item Name - //string//
 +  * Menu Item Name - //string// , Lua Callback - //kaguya::LuaRef//
 +
 +==== Examples ====
 +
 +  * <code lua> local item1 = gui.MenuItem("Item1")</code>
 +  * <code lua> local item1 = gui.MenuItem("Item1", function() message("Item1 Clicked") end)</code>
 +
 +----
 +===== Add Callback =====
 +
 +----
 +
 +==== Description ====
 +
 +Add lua function callback to be called when the menu item is clicked. Multiple callbacks can be added. Callbacks can also be named callbacks i.e. associated with a name so that it can be later removed by use of the name.
 +
 +  * Lua Callback - //kaguya::LuaRef//
 +  * Callback name - //string// , Lua Callback - //kaguya::LuaRef//
 +
 +==== Examples ====
 +
 +  * <code lua> item1:addCallback(function() run_command("LINE") end) </code>
 +  * <code lua> item1:addCallback("message_callback", function() message("Test") end) </code>
 +
 +----
 +
 +===== Remove Callback =====
 +
 +----
 +
 +==== Description ====
 +
 +Remove lua function called associated with the given name. Only named callbacks can be removed.
 +
 +  * Callback name - //string//
 +
 +==== Examples ====
 +
 +  * <code lua> item1:removeCallback("message_callback") </code>
 +
 +----
 +
 +===== Label =====
 +
 +----
 +
 +==== Description ====
 +
 +Get and set label for the menu item.
 +
 +==== Examples ====
 +
 +  * <code lua> message(item1:label()) </code>
 +  * <code lua> item1:setLabel("New Label")</code>
 +
 +----
 +
 +===== Hide and Show =====
 +
 +----
 +
 +==== Description ====
 +
 +Hide or show the menu item.
 +
 +==== Examples ====
 +
 +  * <code lua> item1:hide() </code>
 +  * <code lua> item1:show() </code>
 +
 +----
 +
 +===== Position =====
 +
 +----
 +
 +==== Description ====
 +
 +Get the current menu item position or set the menu item position. Other items are rearranged accordingly.
 +
 +  * New Position - //int//
 +
 +==== Examples ====
 +
 +  * <code lua> local pos = item1:position() </code>
 +  * <code lua> item1:setPosition(2) </code>
 +
 +----
 +
 +===== Remove =====
 +
 +----
 +
 +==== Description ====
 +
 +Remove the current menu item from the parent menu.
 +
 +==== Examples ====
 +
 +  * <code lua> item1:remove() </code>
 +
 +----
dev/v3/gui_api/menu/menu.1594015457.txt.gz · Last modified: 2020/07/06 06:04 by jedi18

Page Tools

  • Show page
  • Old revisions
  • Backlinks
  • Export to PDF
  • Rename Page
  • Back to top
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki