~ubuntu-branches/ubuntu/wily/qtbase-opensource-src/wily

« back to all changes in this revision

Viewing changes to src/gui/kernel/qplatformmenu.h

  • Committer: Package Import Robot
  • Author(s): Timo Jyrinki
  • Date: 2013-02-05 12:46:17 UTC
  • Revision ID: package-import@ubuntu.com-20130205124617-c8jouts182j002fx
Tags: upstream-5.0.1+dfsg
Import upstream version 5.0.1+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
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
 
6
**
 
7
** This file is part of the QtGui module of the Qt Toolkit.
 
8
**
 
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.
 
17
**
 
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.
 
25
**
 
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.
 
29
**
 
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.
 
37
**
 
38
**
 
39
** $QT_END_LICENSE$
 
40
**
 
41
****************************************************************************/
 
42
 
 
43
#ifndef QPLATFORMMENU_H
 
44
#define QPLATFORMMENU_H
 
45
//
 
46
//  W A R N I N G
 
47
//  -------------
 
48
//
 
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.
 
52
//
 
53
 
 
54
#include <QtCore/qglobal.h>
 
55
#include <QtCore/qpointer.h>
 
56
#include <QtGui/QFont>
 
57
#include <QtGui/QKeySequence>
 
58
#include <QtGui/QIcon>
 
59
 
 
60
QT_BEGIN_HEADER
 
61
 
 
62
QT_BEGIN_NAMESPACE
 
63
 
 
64
class QPlatformMenu;
 
65
class Q_GUI_EXPORT QPlatformMenuItem : public QObject
 
66
{
 
67
Q_OBJECT
 
68
public:
 
69
    // copied from, and must stay in sync with, QAction menu roles.
 
70
    enum MenuRole { NoRole = 0, TextHeuristicRole, ApplicationSpecificRole, AboutQtRole,
 
71
                    AboutRole, PreferencesRole, QuitRole };
 
72
 
 
73
    virtual void setTag(quintptr tag) = 0;
 
74
    virtual quintptr tag()const = 0;
 
75
 
 
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;
 
86
Q_SIGNALS:
 
87
    void activated();
 
88
    void hovered();
 
89
};
 
90
 
 
91
class Q_GUI_EXPORT QPlatformMenu : public QObject
 
92
{
 
93
Q_OBJECT
 
94
public:
 
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;
 
99
 
 
100
    virtual void setTag(quintptr tag) = 0;
 
101
    virtual quintptr tag()const = 0;
 
102
 
 
103
    virtual void setText(const QString &text) = 0;
 
104
    virtual void setEnabled(bool enabled) = 0;
 
105
    virtual void setVisible(bool visible) = 0;
 
106
 
 
107
    virtual QPlatformMenuItem *menuItemAt(int position) const = 0;
 
108
    virtual QPlatformMenuItem *menuItemForTag(quintptr tag) const = 0;
 
109
Q_SIGNALS:
 
110
    void aboutToShow();
 
111
    void aboutToHide();
 
112
};
 
113
 
 
114
class Q_GUI_EXPORT QPlatformMenuBar : public QObject
 
115
{
 
116
Q_OBJECT
 
117
public:
 
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;
 
122
 
 
123
    virtual QPlatformMenu *menuForTag(quintptr tag) const = 0;
 
124
};
 
125
 
 
126
QT_END_NAMESPACE
 
127
 
 
128
QT_END_HEADER
 
129
 
 
130
#endif
 
131