File: qmenuproto.h

package info (click to toggle)
postbooks 4.9.5-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 103,120 kB
  • sloc: cpp: 288,269; sh: 607; xml: 214; awk: 104; makefile: 49
file content (75 lines) | stat: -rw-r--r-- 3,320 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
 * This file is part of the xTuple ERP: PostBooks Edition, a free and
 * open source Enterprise Resource Planning software suite,
 * Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
 * It is licensed to you under the Common Public Attribution License
 * version 1.0, the full text of which (including xTuple-specific Exhibits)
 * is available at www.xtuple.com/CPAL.  By using this software, you agree
 * to be bound by its terms.
 */

#ifndef __QMENUPROTO_H__
#define __QMENUPROTO_H__

#include <QMenu>
#include <QObject>
#include <QtScript>

#include "qactionproto.h"

Q_DECLARE_METATYPE(QMenu*)

void setupQMenuProto(QScriptEngine *engine);
QScriptValue constructQMenu(QScriptContext *context, QScriptEngine *engine);

class QMenuProto : public QObject, public QScriptable
{
  Q_OBJECT

  public:
    QMenuProto(QObject *parent);

    Q_INVOKABLE QAction *actionAt(const QPoint &pt)	const;
    Q_INVOKABLE QRect    actionGeometry(QAction *act)	const;
    Q_INVOKABLE QAction *activeAction()	                const;
    Q_INVOKABLE QList<QAction*> actions()               const;
    Q_INVOKABLE QAction *addAction(const QString &text);
    Q_INVOKABLE QAction *addAction(const QIcon &icon, const QString &text);
    Q_INVOKABLE QAction *addAction(const QString &text, const QObject *receiver, const char *member, const QKeySequence &shortcut = 0);
    Q_INVOKABLE QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, const char *member, const QKeySequence &shortcut = 0);
    Q_INVOKABLE void     appendAction(QAction *action);
    Q_INVOKABLE QAction *addMenu(QMenu *menu);
    Q_INVOKABLE QMenu   *addMenu(const QString &title);
    Q_INVOKABLE QMenu   *addMenu(const QIcon &icon, const QString &title);
    Q_INVOKABLE QAction *addSeparator();
    Q_INVOKABLE void     clear();
    Q_INVOKABLE QAction *defaultAction()	        const;
    Q_INVOKABLE QAction *exec();
    Q_INVOKABLE QAction *exec(const QPoint &p, QAction *action = 0);
    Q_INVOKABLE void     hideTearOffMenu();
    Q_INVOKABLE QIcon    icon()	                        const;
    Q_INVOKABLE void     insertAction(QAction *before, QAction *action);
    Q_INVOKABLE void     insertActions(QAction *before, QList<QAction*>actions);
    Q_INVOKABLE QAction *insertMenu(QAction *before, QMenu *menu);
    Q_INVOKABLE QAction *insertSeparator(QAction *before);
    Q_INVOKABLE bool     isEmpty()	                const;
    Q_INVOKABLE bool     isTearOffEnabled()	        const;
    Q_INVOKABLE bool     isTearOffMenuVisible()	        const;
    Q_INVOKABLE QAction *menuAction()	                const;
    Q_INVOKABLE void     popup(const QPoint &p, QAction *atAction = 0);
    Q_INVOKABLE void     removeAction(QAction *action);
    Q_INVOKABLE bool     separatorsCollapsible()	const;
    Q_INVOKABLE void     setActiveAction(QAction *act);
    Q_INVOKABLE void     setDefaultAction(QAction *act);
    Q_INVOKABLE void     setIcon(const QIcon &icon);
    Q_INVOKABLE void     setSeparatorsCollapsible(bool collapse);
    Q_INVOKABLE void     setTearOffEnabled(bool);
    Q_INVOKABLE void     setTitle(const QString &title);
    Q_INVOKABLE QString  title()	                const;
    // Q_INVOKABLE HMENU    wceMenu(bool create = false);

    Q_INVOKABLE QString  toString()                     const;

};

#endif