History

API to hide desktop menubar while keeping menu items

Ada committed 1 year ago

Commit f5ea94e1 parent 1551c173 files · +65 −9Browse files

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

Unified · Split

interface/src/scripting/MenuScriptingInterface.h+26−0
@@ -34,6 +34,8 @@ class MenuItemProperties; · 33 unmodified lines
3434 * @hifi-interface
3535 * @hifi-client-entity
3636 * @hifi-avatar
37+ *
38+ * @property {boolean} visible - <code>true</code> if the menu bar is visible on the desktop window.
3739 */
3840
3941 /**
@@ -48,6 +50,8 @@ class MenuItemProperties; · 8 unmodified lines
4850
4951 class MenuScriptingInterface : public QObject {
5052 Q_OBJECT
53+ Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibilityChanged)
54+
5155 MenuScriptingInterface() { };
5256 public:
5357 static MenuScriptingInterface* getInstance();
@@ -218,6 +222,20 @@ public slots: · 164 unmodified lines
218222 */
219223 void setMenuEnabled(const QString& menuName, bool isEnabled);
220224
225+ /*@jsdoc
226+ * Sets the visibility of the desktop menubar.
227+ * @function Menu.setVisible
228+ * @param {boolean} visible - If <code>true</code>, the menubar is visible on the desktop window.
229+ */
230+ void setVisible(bool visible);
231+
232+ /*@jsdoc
233+ * Gets the visibility of the desktop menubar.
234+ * @function Menu.isVisible
235+ * @returns {boolean} <code>true</code> if the menubar is visible on the desktop window.
236+ */
237+ bool isVisible();
238+
221239 signals:
222240 /*@jsdoc
223241 * Triggered when a menu item is clicked or triggered by {@link Menu.triggerOption}.
@@ -232,6 +250,14 @@ signals: · 8 unmodified lines
232250 * Menu.menuItemEvent.connect(onMenuItemEvent);
233251 */
234252 void menuItemEvent(const QString& menuItem);
253+
254+ /*@jsdoc
255+ * Triggered when <code>Menu.visible</code> is changed.
256+ * @function Menu.visibilityChanged
257+ * @param {boolean} visible - <code>true</code> if the menubar is visible on the desktop window.
258+ * @returns {Signal}
259+ */
260+ void visibilityChanged(bool visible);
235261 };
236262
237263 #endif // hifi_MenuScriptingInterface_h