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
22 * on a user's desktop and in the tablet when the "MENU" button is pressed.22 * on a user's desktop and in the tablet when the "MENU" button is pressed.
23 *23 *
24 * <h3>Groupings</h3>24 * <h3>Groupings</h3>
25 *
25 * A "grouping" provides a way to group a set of menus or menu items together so 26 * A "grouping" provides a way to group a set of menus or menu items together so
26 * that they can all be set visible or invisible as a group. 27 * that they can all be set visible or invisible as a group.
27 * There are two available groups: <code>"Advanced"</code> and <code>"Developer"</code>.28 * There are two available groups: <code>"Advanced"</code> and <code>"Developer"</code>.
@@ -29,6 +30,23 @@ class MenuItemProperties; · 1 unmodified line
29 * If a menu item doesn't belong to a group it is always displayed.30 * If a menu item doesn't belong to a group it is always displayed.
30 *31 *
31 * @namespace Menu32 * @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);
32 */50 */
33 51
34/**52/**
@@ -55,8 +73,11 @@ public slots: · 20 unmodified lines
55 /**jsdoc73 /**jsdoc
56 * Add a new top-level menu.74 * Add a new top-level menu.
57 * @function Menu.addMenu75 * @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.
59 * @param {String} [grouping] Name of the grouping, if any, to add this menu to.77 * @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");
60 */81 */
61 void addMenu(const QString& menuName, const QString& grouping = QString());82 void addMenu(const QString& menuName, const QString& grouping = QString());
62 83
@@ -64,6 +85,9 @@ public slots: · 1 unmodified line
64 * Remove a top-level menu.85 * Remove a top-level menu.
65 * @function Menu.removeMenu86 * @function Menu.removeMenu
66 * @param {String} menuName Name of the menu to remove.87 * @param {String} menuName Name of the menu to remove.
88 * @example
89 * Menu.removeMenu("Test Menu > Test Sub Menu");
90 * Menu.removeMenu("Test Menu");
67 */91 */
68 void removeMenu(const QString& menuName);92 void removeMenu(const QString& menuName);
69 93
@@ -72,6 +96,10 @@ public slots: · 2 unmodified lines
72 * @function Menu.menuExists96 * @function Menu.menuExists
73 * @param {String} menuName Name of the menu to check for existence.97 * @param {String} menuName Name of the menu to check for existence.
74 * @returns {Boolean} <code>true</code> if the menu exists, otherwise <code>false</code>.98 * @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 * }
75 */103 */
76 bool menuExists(const QString& menuName);104 bool menuExists(const QString& menuName);
77 105
@@ -81,6 +109,8 @@ public slots: · 3 unmodified lines
81 * @function Menu.addSeparator109 * @function Menu.addSeparator
82 * @param {String} menuName Name of the menu to add a separator to.110 * @param {String} menuName Name of the menu to add a separator to.
83 * @param {String} separatorName Name of the separator that will be displayed as the label below the separator line.111 * @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");
84 */114 */
85 void addSeparator(const QString& menuName, const QString& separatorName);115 void addSeparator(const QString& menuName, const QString& separatorName);
86 116
@@ -89,6 +119,8 @@ public slots: · 2 unmodified lines
89 * @function Menu.removeSeparator119 * @function Menu.removeSeparator
90 * @param {String} menuName Name of the menu to remove the separator from.120 * @param {String} menuName Name of the menu to remove the separator from.
91 * @param {String} separatorName Name of the separator to remove.121 * @param {String} separatorName Name of the separator to remove.
122 * @example
123 * Menu.removeSeparator("Developer","Test Separator");
92 */124 */
93 void removeSeparator(const QString& menuName, const QString& separatorName);125 void removeSeparator(const QString& menuName, const QString& separatorName);
94 126
@@ -96,6 +128,14 @@ public slots: · 1 unmodified line
96 * Add a new menu item to a menu.128 * Add a new menu item to a menu.
97 * @function Menu.addMenuItem129 * @function Menu.addMenuItem
98 * @param {Menu.MenuItemProperties} properties Properties of the menu item to create.130 * @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 * });
99 */139 */
100 void addMenuItem(const MenuItemProperties& properties);140 void addMenuItem(const MenuItemProperties& properties);
101 141
@@ -105,6 +145,8 @@ public slots: · 3 unmodified lines
105 * @param {String} menuName Name of the menu to add a menu item to.145 * @param {String} menuName Name of the menu to add a menu item to.
106 * @param {String} menuItem Name of the menu item. This is what will be displayed in the menu.146 * @param {String} menuItem Name of the menu item. This is what will be displayed in the menu.
107 * @param {String} [shortcutKey] A shortcut key that can be used to trigger the menu item.147 * @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");
108 */150 */
109 void addMenuItem(const QString& menuName, const QString& menuitem, const QString& shortcutKey);151 void addMenuItem(const QString& menuName, const QString& menuitem, const QString& shortcutKey);
110 void addMenuItem(const QString& menuName, const QString& menuitem);152 void addMenuItem(const QString& menuName, const QString& menuitem);
@@ -114,6 +156,7 @@ public slots: · 3 unmodified lines
114 * @function Menu.removeMenuItem156 * @function Menu.removeMenuItem
115 * @param {String} menuName Name of the menu to remove a menu item from.157 * @param {String} menuName Name of the menu to remove a menu item from.
116 * @param {String} menuItem Name of the menu item to remove.158 * @param {String} menuItem Name of the menu item to remove.
159 * Menu.removeMenuItem("Developer", "Test");
117 */160 */
118 void removeMenuItem(const QString& menuName, const QString& menuitem);161 void removeMenuItem(const QString& menuName, const QString& menuitem);
119 162
@@ -123,6 +166,10 @@ public slots: · 3 unmodified lines
123 * @param {String} menuName Name of the menu that the menu item is in.166 * @param {String} menuName Name of the menu that the menu item is in.
124 * @param {String} menuItem Name of the menu item to check for existence of.167 * @param {String} menuItem Name of the menu item to check for existence of.
125 * @returns {Boolean} <code>true</code> if the menu item exists, otherwise <code>false</code>.168 * @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 * }
126 */173 */
127 bool menuItemExists(const QString& menuName, const QString& menuitem);174 bool menuItemExists(const QString& menuName, const QString& menuitem);
128 175
@@ -185,6 +232,12 @@ signals: · 56 unmodified lines
185 * @function Menu.menuItemEvent232 * @function Menu.menuItemEvent
186 * @param {String} menuItem Name of the menu item that was clicked.233 * @param {String} menuItem Name of the menu item that was clicked.
187 * @returns {Signal}234 * @returns {Signal}
235 * @example
236 * function onMenuItemEvent(menuItem) {
237 * print("You clicked on " + menuItem);
238 * }
239 *
240 * Menu.menuItemEvent.connect(onMenuItemEvent);
188 */241 */
189 void menuItemEvent(const QString& menuItem);242 void menuItemEvent(const QString& menuItem);
190};243};