| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the Qt Quick Controls module of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU Lesser General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
| 19 | ** General Public License version 3 as published by the Free Software |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
| 21 | ** packaging of this file. Please review the following information to |
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements |
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
| 24 | ** |
| 25 | ** GNU General Public License Usage |
| 26 | ** Alternatively, this file may be used under the terms of the GNU |
| 27 | ** General Public License version 2.0 or (at your option) the GNU General |
| 28 | ** Public license version 3 or any later version approved by the KDE Free |
| 29 | ** Qt Foundation. The licenses are as published by the Free Software |
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
| 31 | ** included in the packaging of this file. Please review the following |
| 32 | ** information to ensure the GNU General Public License requirements will |
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
| 35 | ** |
| 36 | ** $QT_END_LICENSE$ |
| 37 | ** |
| 38 | ****************************************************************************/ |
| 39 | |
| 40 | #ifndef QQUICKMENU_P_H |
| 41 | #define |
| 42 | |
| 43 | #include "qquickmenuitem_p.h" |
| 44 | |
| 45 | #include <QtCore/qglobal.h> |
| 46 | #include <QtCore/qvariant.h> |
| 47 | #include <QtQml/qqml.h> |
| 48 | #include <QtQml/qqmllist.h> |
| 49 | #include <QtGui/QFont> |
| 50 | |
| 51 | QT_BEGIN_NAMESPACE |
| 52 | |
| 53 | class ; |
| 54 | class ; |
| 55 | class ; |
| 56 | class QQuickWindow; |
| 57 | class ; |
| 58 | |
| 59 | typedef QQmlListProperty<QObject> ; |
| 60 | |
| 61 | class : public QQuickMenuText1 |
| 62 | { |
| 63 | Q_OBJECT |
| 64 | Q_PROPERTY(QString title READ text WRITE setText NOTIFY titleChanged) |
| 65 | Q_PROPERTY(QQmlListProperty<QObject> items READ menuItems NOTIFY itemsChanged) |
| 66 | Q_CLASSINFO("DefaultProperty" , "items" ) |
| 67 | |
| 68 | Q_PROPERTY(int __selectedIndex READ selectedIndex WRITE setSelectedIndex NOTIFY __selectedIndexChanged) |
| 69 | Q_PROPERTY(bool __popupVisible READ popupVisible NOTIFY popupVisibleChanged) |
| 70 | Q_PROPERTY(QQuickItem *__contentItem READ menuContentItem WRITE setMenuContentItem NOTIFY menuContentItemChanged) |
| 71 | Q_PROPERTY(int __minimumWidth READ minimumWidth WRITE setMinimumWidth NOTIFY minimumWidthChanged) |
| 72 | Q_PROPERTY(QFont __font READ font WRITE setFont) |
| 73 | Q_PROPERTY(qreal __xOffset READ xOffset WRITE setXOffset) |
| 74 | Q_PROPERTY(qreal __yOffset READ yOffset WRITE setYOffset) |
| 75 | Q_PROPERTY(QQuickAction1 *__action READ action CONSTANT) |
| 76 | Q_PROPERTY(QRect __popupGeometry READ popupGeometry NOTIFY __popupGeometryChanged) |
| 77 | Q_PROPERTY(bool __isProxy READ isProxy WRITE setProxy NOTIFY __proxyChanged) |
| 78 | Q_ENUMS(MenuType) |
| 79 | |
| 80 | public: |
| 81 | // MenuType must stay in sync with QPlatformMenu::MenuType |
| 82 | enum { = 0, }; |
| 83 | |
| 84 | Q_INVOKABLE void (); |
| 85 | Q_INVOKABLE QQuickMenuItem1 *(const QString &); |
| 86 | Q_INVOKABLE QQuickMenuItem1 *(int, const QString &); |
| 87 | Q_INVOKABLE void (); |
| 88 | Q_INVOKABLE void (int); |
| 89 | |
| 90 | Q_INVOKABLE void (int, QQuickMenuBase1 *); |
| 91 | Q_INVOKABLE void (QQuickMenuBase1 *); |
| 92 | Q_INVOKABLE void (); |
| 93 | |
| 94 | Q_INVOKABLE void (const QRectF &targetRect, int atItemIndex = -1, MenuType = DefaultMenu); |
| 95 | |
| 96 | public Q_SLOTS: |
| 97 | void (); |
| 98 | |
| 99 | void __closeAndDestroy(); |
| 100 | void __dismissAndDestroy(); |
| 101 | |
| 102 | Q_SIGNALS: |
| 103 | void (); |
| 104 | void (); |
| 105 | |
| 106 | void (); |
| 107 | void (); |
| 108 | void (); |
| 109 | void (); |
| 110 | void (); |
| 111 | void (); |
| 112 | void (); |
| 113 | void (); |
| 114 | void (); |
| 115 | |
| 116 | public: |
| 117 | (QObject *parent = 0); |
| 118 | virtual (); |
| 119 | |
| 120 | void (bool) override; |
| 121 | void (bool) override; |
| 122 | |
| 123 | int () const { return m_selectedIndex; } |
| 124 | void (int index); |
| 125 | |
| 126 | QQuickMenuItems (); |
| 127 | QQuickMenuBase1 *(int index) const; |
| 128 | bool (QQuickMenuBase1 *); |
| 129 | int (QQuickMenuBase1 *) const; |
| 130 | |
| 131 | QPlatformMenu *() const { return m_platformMenu; } |
| 132 | |
| 133 | int () const { return m_minimumWidth; } |
| 134 | void (int w); |
| 135 | |
| 136 | void (const QFont &font); |
| 137 | QFont () const { return m_font; } |
| 138 | |
| 139 | qreal () const { return m_xOffset; } |
| 140 | void (qreal); |
| 141 | qreal () const { return m_yOffset; } |
| 142 | void (qreal); |
| 143 | |
| 144 | QQuickItem *() const { return m_menuContentItem; } |
| 145 | bool () const { return m_popupVisible; } |
| 146 | |
| 147 | bool () override { return m_platformMenu != 0; } |
| 148 | |
| 149 | QRect () const; |
| 150 | |
| 151 | bool () const { return m_proxy; } |
| 152 | void (bool proxy) { if (m_proxy != proxy) { m_proxy = proxy; emit __proxyChanged(); } } |
| 153 | |
| 154 | void (QQuickMenuItem1 *); |
| 155 | void (QQuickMenuItem1 *); |
| 156 | void (); |
| 157 | void (); |
| 158 | |
| 159 | QQuickMenuBar1 *(); |
| 160 | |
| 161 | protected Q_SLOTS: |
| 162 | void (); |
| 163 | |
| 164 | void (QQuickItem *); |
| 165 | void (bool); |
| 166 | void (); |
| 167 | void (); |
| 168 | |
| 169 | void () override; |
| 170 | void (bool); |
| 171 | void (bool); |
| 172 | |
| 173 | private: |
| 174 | QQuickWindow *(); |
| 175 | void (); |
| 176 | QQuickMenuPopupWindow1 *() const; |
| 177 | |
| 178 | int (int listIndex) const; |
| 179 | void (int, int *, int *) const; |
| 180 | |
| 181 | struct |
| 182 | { |
| 183 | (): index(-1), containerIndex(-1) {} |
| 184 | int , ; |
| 185 | }; |
| 186 | |
| 187 | QQuickMenuBase1 *(MenuItemIterator *) const; |
| 188 | |
| 189 | static void (QQuickMenuItems *list, QObject *o); |
| 190 | static int (QQuickMenuItems *list); |
| 191 | static QObject *(QQuickMenuItems *list, int index); |
| 192 | static void (QQuickMenuItems *list); |
| 193 | |
| 194 | void (QQuickMenuBase1 *); |
| 195 | void (QQuickMenuBase1 *item, int platformIndex = -1); |
| 196 | |
| 197 | QPlatformMenu *; |
| 198 | QList<QQuickMenuBase1 *> ; |
| 199 | QHash<QObject *, QQuickMenuItemContainer1 *> ; |
| 200 | int ; |
| 201 | int ; |
| 202 | int ; |
| 203 | QQuickWindow *; |
| 204 | int ; |
| 205 | QQuickMenuPopupWindow1 *; |
| 206 | QQuickItem * ; |
| 207 | bool ; |
| 208 | int ; |
| 209 | qreal ; |
| 210 | qreal ; |
| 211 | QFont ; |
| 212 | int ; |
| 213 | bool ; |
| 214 | QMetaObject::Connection ; |
| 215 | }; |
| 216 | |
| 217 | QT_END_NAMESPACE |
| 218 | |
| 219 | QML_DECLARE_TYPE(QQuickMenu1) |
| 220 | |
| 221 | #endif // QQUICKMENU_P_H |
| 222 | |