History

Expand Menu's JSDoc

David Rowe committed 9 years ago

Commit f5e155b1 parent c8734cc2 files · +55 −2Browse files

Showing the changes to interface/src/scripting/MenuScriptingInterface.h (1 of 2 files). Show all

Unified · Split

interface/src/scripting/MenuScriptingInterface.h+54−1
@@ -22,6 +22,7 @@ class MenuItemProperties; · 21 unmodified lines
2222 * on a user's desktop and in the tablet when the "MENU" button is pressed.
2323 *
2424 * <h3>Groupings</h3>
25+ *
2526 * A "grouping" provides a way to group a set of menus or menu items together so
2627 * that they can all be set visible or invisible as a group.
2728 * There are two available groups: <code>"Advanced"</code> and <code>"Developer"</code>.
@@ -29,6 +30,23 @@ class MenuItemProperties; · 1 unmodified line
2930 * If a menu item doesn't belong to a group it is always displayed.
3031 *
3132 * @namespace Menu
33+ *
34+ * @example
35+ * Menu.addMenu("Demo Menu");
36+ *
37+ * Menu.addMenuItem({
38+ * menuName: "Demo Menu",
39+ * menuItemName: "Demo Item"
40+ * });
41+ *
42+ * function onMenuItemEvent(menuItem)
43+ * {
44+ * if(menuItem == "Demo Item") {
45+ * print("Nice! You clicked the demo menu item.");
46+ * }
47+ * }
48+ *
49+ * Menu.menuItemEvent.connect(menuItemEventHandler);
3250 */
3351
3452 /**
@@ -55,8 +73,11 @@ public slots: · 20 unmodified lines
5573 /**jsdoc
5674 * Add a new top-level menu.
5775 * @function Menu.addMenu
58− * @param {String} menuName Name that will be displayed for the menu.
76+ * @param {String} menuName Name that will be displayed for the menu. Nested menus can be described using the ">" symbol.
5977 * @param {String} [grouping] Name of the grouping, if any, to add this menu to.
78+ * @example
79+ * Menu.addMenu("Test Menu");
80+ * Menu.addMenu("Test Menu > Test Sub Menu");
6081 */
6182 void addMenu(const QString& menuName, const QString& grouping = QString());
6283
@@ -64,6 +85,9 @@ public slots: · 1 unmodified line
6485 * Remove a top-level menu.
6586 * @function Menu.removeMenu
6687 * @param {String} menuName Name of the menu to remove.
88+ * @example
89+ * Menu.removeMenu("Test Menu > Test Sub Menu");
90+ * Menu.removeMenu("Test Menu");
6791 */
6892 void removeMenu(const QString& menuName);
6993
@@ -72,6 +96,10 @@ public slots: · 2 unmodified lines
7296 * @function Menu.menuExists
7397 * @param {String} menuName Name of the menu to check for existence.
7498 * @returns {Boolean} <code>true</code> if the menu exists, otherwise <code>false</code>.
99+ * @example
100+ * if (Menu.menuExists("Developer")) {
101+ * // Perform a task if there is a Developer menu.
102+ * }
75103 */
76104 bool menuExists(const QString& menuName);
77105
@@ -81,6 +109,8 @@ public slots: · 3 unmodified lines
81109 * @function Menu.addSeparator
82110 * @param {String} menuName Name of the menu to add a separator to.
83111 * @param {String} separatorName Name of the separator that will be displayed as the label below the separator line.
112+ * @example
113+ * Menu.addSeparator("Developer","Test Separator");
84114 */
85115 void addSeparator(const QString& menuName, const QString& separatorName);
86116
@@ -89,6 +119,8 @@ public slots: · 2 unmodified lines
89119 * @function Menu.removeSeparator
90120 * @param {String} menuName Name of the menu to remove the separator from.
91121 * @param {String} separatorName Name of the separator to remove.
122+ * @example
123+ * Menu.removeSeparator("Developer","Test Separator");
92124 */
93125 void removeSeparator(const QString& menuName, const QString& separatorName);
94126
@@ -96,6 +128,14 @@ public slots: · 1 unmodified line
96128 * Add a new menu item to a menu.
97129 * @function Menu.addMenuItem
98130 * @param {Menu.MenuItemProperties} properties Properties of the menu item to create.
131+ * @example
132+ * Menu.addMenuItem({
133+ * menuName: "Developer",
134+ * menuItemName: "Test",
135+ * afterItem: "Log",
136+ * shortcutKey: "Ctrl+Shift+T",
137+ * grouping: "Advanced"
138+ * });
99139 */
100140 void addMenuItem(const MenuItemProperties& properties);
101141
@@ -105,6 +145,8 @@ public slots: · 3 unmodified lines
105145 * @param {String} menuName Name of the menu to add a menu item to.
106146 * @param {String} menuItem Name of the menu item. This is what will be displayed in the menu.
107147 * @param {String} [shortcutKey] A shortcut key that can be used to trigger the menu item.
148+ * @example
149+ * Menu.addMenuItem("Developer", "Test", "Ctrl+Shift+T");
108150 */
109151 void addMenuItem(const QString& menuName, const QString& menuitem, const QString& shortcutKey);
110152 void addMenuItem(const QString& menuName, const QString& menuitem);
@@ -114,6 +156,7 @@ public slots: · 3 unmodified lines
114156 * @function Menu.removeMenuItem
115157 * @param {String} menuName Name of the menu to remove a menu item from.
116158 * @param {String} menuItem Name of the menu item to remove.
159+ * Menu.removeMenuItem("Developer", "Test");
117160 */
118161 void removeMenuItem(const QString& menuName, const QString& menuitem);
119162
@@ -123,6 +166,10 @@ public slots: · 3 unmodified lines
123166 * @param {String} menuName Name of the menu that the menu item is in.
124167 * @param {String} menuItem Name of the menu item to check for existence of.
125168 * @returns {Boolean} <code>true</code> if the menu item exists, otherwise <code>false</code>.
169+ * @example
170+ * if (Menu.menuItemExists("Developer", "Stats")) {
171+ * // Perform a task if there is a Stats item in the Developer menu.
172+ * }
126173 */
127174 bool menuItemExists(const QString& menuName, const QString& menuitem);
128175
@@ -185,6 +232,12 @@ signals: · 56 unmodified lines
185232 * @function Menu.menuItemEvent
186233 * @param {String} menuItem Name of the menu item that was clicked.
187234 * @returns {Signal}
235+ * @example
236+ * function onMenuItemEvent(menuItem) {
237+ * print("You clicked on " + menuItem);
238+ * }
239+ *
240+ * Menu.menuItemEvent.connect(onMenuItemEvent);
188241 */
189242 void menuItemEvent(const QString& menuItem);
190243 };