1
/****************************************************************************
3
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4
** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author James Turner <james.turner@kdab.com>
5
** Contact: http://www.qt-project.org/legal
7
** This file is part of the QtGui module of the Qt Toolkit.
9
** $QT_BEGIN_LICENSE:LGPL$
10
** Commercial License Usage
11
** Licensees holding valid commercial Qt licenses may use this file in
12
** accordance with the commercial license agreement provided with the
13
** Software or, alternatively, in accordance with the terms contained in
14
** a written agreement between you and Digia. For licensing terms and
15
** conditions see http://qt.digia.com/licensing. For further information
16
** use the contact form at http://qt.digia.com/contact-us.
18
** GNU Lesser General Public License Usage
19
** Alternatively, this file may be used under the terms of the GNU Lesser
20
** General Public License version 2.1 as published by the Free Software
21
** Foundation and appearing in the file LICENSE.LGPL included in the
22
** packaging of this file. Please review the following information to
23
** ensure the GNU Lesser General Public License version 2.1 requirements
24
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
26
** In addition, as a special exception, Digia gives you certain additional
27
** rights. These rights are described in the Digia Qt LGPL Exception
28
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
30
** GNU General Public License Usage
31
** Alternatively, this file may be used under the terms of the GNU
32
** General Public License version 3.0 as published by the Free Software
33
** Foundation and appearing in the file LICENSE.GPL included in the
34
** packaging of this file. Please review the following information to
35
** ensure the GNU General Public License version 3.0 requirements will be
36
** met: http://www.gnu.org/copyleft/gpl.html.
41
****************************************************************************/
43
#ifndef QPLATFORMMENU_H
44
#define QPLATFORMMENU_H
49
// This file is part of the QPA API and is not meant to be used
50
// in applications. Usage of this API may make your code
51
// source and binary incompatible with future versions of Qt.
54
#include <QtCore/qglobal.h>
55
#include <QtCore/qpointer.h>
56
#include <QtGui/QFont>
57
#include <QtGui/QKeySequence>
58
#include <QtGui/QIcon>
65
class Q_GUI_EXPORT QPlatformMenuItem : public QObject
69
// copied from, and must stay in sync with, QAction menu roles.
70
enum MenuRole { NoRole = 0, TextHeuristicRole, ApplicationSpecificRole, AboutQtRole,
71
AboutRole, PreferencesRole, QuitRole };
73
virtual void setTag(quintptr tag) = 0;
74
virtual quintptr tag()const = 0;
76
virtual void setText(const QString &text) = 0;
77
virtual void setIcon(const QIcon &icon) = 0;
78
virtual void setMenu(QPlatformMenu *menu) = 0;
79
virtual void setVisible(bool isVisible) = 0;
80
virtual void setIsSeparator(bool isSeparator) = 0;
81
virtual void setFont(const QFont &font) = 0;
82
virtual void setRole(MenuRole role) = 0;
83
virtual void setChecked(bool isChecked) = 0;
84
virtual void setShortcut(const QKeySequence& shortcut) = 0;
85
virtual void setEnabled(bool enabled) = 0;
91
class Q_GUI_EXPORT QPlatformMenu : public QObject
95
virtual void insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem *before) = 0;
96
virtual void removeMenuItem(QPlatformMenuItem *menuItem) = 0;
97
virtual void syncMenuItem(QPlatformMenuItem *menuItem) = 0;
98
virtual void syncSeparatorsCollapsible(bool enable) = 0;
100
virtual void setTag(quintptr tag) = 0;
101
virtual quintptr tag()const = 0;
103
virtual void setText(const QString &text) = 0;
104
virtual void setEnabled(bool enabled) = 0;
105
virtual void setVisible(bool visible) = 0;
107
virtual QPlatformMenuItem *menuItemAt(int position) const = 0;
108
virtual QPlatformMenuItem *menuItemForTag(quintptr tag) const = 0;
114
class Q_GUI_EXPORT QPlatformMenuBar : public QObject
118
virtual void insertMenu(QPlatformMenu *menu, QPlatformMenu *before) = 0;
119
virtual void removeMenu(QPlatformMenu *menu) = 0;
120
virtual void syncMenu(QPlatformMenu *menuItem) = 0;
121
virtual void handleReparent(QWindow *newParentWindow) = 0;
123
virtual QPlatformMenu *menuForTag(quintptr tag) const = 0;