This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
dev:v3:gui_api:menu:menu [2020/07/06 15:51] – jedi18 | dev:v3:gui_api:menu:menu [2020/07/07 04:18] (current) – jedi18 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Menu GUI Class ====== | + | ====== Menu Item GUI Class ====== |
- | [[https:// | + | [[https:// |
<code cpp-qt> namespace lc::ui::api </ | <code cpp-qt> namespace lc::ui::api </ | ||
---- | ---- | ||
- | ===== Menu Constructor ===== | + | ===== Menu Item Constructor ===== |
---- | ---- | ||
Line 10: | Line 10: | ||
==== Description ==== | ==== Description ==== | ||
- | Constructs a menu gui object. Menu after being constructed needs to be added to the mainwindow menu bar or to another | + | 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 Name - //string// | + | * Menu Item Name - //string// |
+ | * Menu Item Name - //string// , Lua Callback - // | ||
==== Examples ==== | ==== Examples ==== | ||
- | * <code lua> local menu1 = gui.Menu("Test" | + | * <code lua> local item1 = gui.MenuItem("Item1")</ |
+ | * <code lua> local item1 = gui.MenuItem(" | ||
---- | ---- | ||
- | ===== Add Menu Item ===== | + | ===== Add Callback |
---- | ---- | ||
Line 25: | Line 27: | ||
==== Description ==== | ==== Description ==== | ||
- | Add menu item to the menu. The item is added to the end of the menu at the last position. | + | Add lua function callback |
- | * Menu Item Label - //string// , Lua Callback - // | + | * Lua Callback - // |
- | * returns //MenuItem// | + | * Callback name - // |
- | * Menu Item Label - //string// | + | |
- | * return // | + | |
- | * Pointer to Menu Item - //MenuItem*// | + | |
==== Examples ==== | ==== Examples ==== | ||
- | * <code lua> | + | * <code lua> item1:addCallback(function() run_command("LINE") end) </ |
- | * <code lua> | + | * <code lua> item1:addCallback("message_callback", function() message(" |
- | * <code lua> local item1 = gui.MenuItem(" | + | |
- | | + | |
---- | ---- | ||
- | ===== Add Menu ===== | + | ===== Remove Callback |
---- | ---- | ||
Line 48: | Line 45: | ||
==== Description ==== | ==== Description ==== | ||
- | Add menu to the menu, menu is added at the end of the menu at the last position. | + | Remove lua function called associated with the given name. Only named callbacks can be removed. |
- | * Menu Label - //string// | + | * Callback name - //string// |
- | * return //Menu// | + | |
- | * Pointer to Menu - //Menu*// | + | |
==== Examples ==== | ==== Examples ==== | ||
- | * <code lua> | + | * <code lua> |
- | * <code lua> local menu2 = gui.Menu(" | + | |
- | | + | |
---- | ---- | ||
+ | ===== Label ===== | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Description ==== | ||
+ | |||
+ | Get and set label for the menu item. | ||
+ | |||
+ | ==== Examples ==== | ||
+ | |||
+ | * <code lua> message(item1: | ||
+ | * <code lua> item1: | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Hide and Show ===== | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Description ==== | ||
+ | |||
+ | Hide or show the menu item. | ||
+ | |||
+ | ==== Examples ==== | ||
+ | |||
+ | * <code lua> item1: | ||
+ | * <code lua> item1: | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== 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: | ||
+ | * <code lua> item1: | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Remove ===== | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Description ==== | ||
+ | |||
+ | Remove the current menu item from the parent menu. | ||
+ | |||
+ | ==== Examples ==== | ||
+ | |||
+ | * <code lua> item1: | ||
+ | |||
+ | ---- |