~ubuntu-sdk-team/ubuntu-ui-toolkit/escapeLittleAmpersand

« back to all changes in this revision

Viewing changes to src/Ubuntu/UbuntuToolkit/menu_p.h

  • Committer: Tarmac
  • Author(s): Nick Dedekind
  • Date: 2016-08-26 13:06:11 UTC
  • mfrom: (2080.1.4 staging)
  • Revision ID: tarmac-20160826130611-pvqtzn2c16c8hgrp
API for MenuBar, Menus, MenuItem & MenuSeparator.

Approved by ubuntu-sdk-build-bot, Zsombor Egri.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2016 Canonical Ltd.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU Lesser General Public License as published by
 
6
 * the Free Software Foundation; version 3.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 */
 
17
 
 
18
#ifndef MENU_P_H
 
19
#define MENU_P_H
 
20
 
 
21
#include <QQmlListProperty>
 
22
#include <QLoggingCategory>
 
23
#include <QPointer>
 
24
#include <ubuntutoolkitglobal.h>
 
25
 
 
26
#include "ucaction_p.h"
 
27
 
 
28
Q_DECLARE_LOGGING_CATEGORY(ucMenu);
 
29
 
 
30
class QPlatformMenu;
 
31
class QPlatformMenuItem;
 
32
class QQuickItem;
 
33
 
 
34
UT_NAMESPACE_BEGIN
 
35
 
 
36
class MenuPrivate;
 
37
class MenuBar;
 
38
class UCAction;
 
39
class UBUNTUTOOLKIT_EXPORT Menu : public UCAction
 
40
{
 
41
    Q_OBJECT
 
42
 
 
43
    Q_PROPERTY(QQmlListProperty<QObject> data READ data FINAL)
 
44
    Q_CLASSINFO("DefaultProperty", "data")
 
45
 
 
46
public:
 
47
    explicit Menu(QObject *parent = 0);
 
48
    ~Menu();
 
49
 
 
50
    QQmlListProperty<QObject> data();
 
51
 
 
52
    Q_INVOKABLE void appendObject(QObject* obj);
 
53
    Q_INVOKABLE void insertObject(int index, QObject* obj);
 
54
    Q_INVOKABLE void removeObject(QObject* obj);
 
55
 
 
56
    QPlatformMenu *platformMenu() const;
 
57
 
 
58
public Q_SLOTS:
 
59
    void show(const QPoint& pt);
 
60
    void dismiss();
 
61
 
 
62
private:
 
63
    Q_DISABLE_COPY(Menu)
 
64
    Q_DECLARE_PRIVATE(Menu)
 
65
    QScopedPointer<MenuPrivate> d_ptr;
 
66
 
 
67
    Q_PRIVATE_SLOT(d_func(), void _q_updateEnabled())
 
68
    Q_PRIVATE_SLOT(d_func(), void _q_updateText())
 
69
    Q_PRIVATE_SLOT(d_func(), void _q_updateIcon())
 
70
    Q_PRIVATE_SLOT(d_func(), void _q_updateVisible())
 
71
};
 
72
 
 
73
UT_NAMESPACE_END
 
74
 
 
75
#endif // MENU_P_H