Scribus
Open source desktop publishing at your fingertips
scmenu.h
1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 /***************************************************************************
8  begin : Jan 2005
9  copyright : (C) 2005 by Craig Bradney
10  email : cbradney@zip.com.au
11  ***************************************************************************/
12 
13 /***************************************************************************
14  * *
15  * This program is free software; you can redistribute it and/or modify *
16  * it under the terms of the GNU General Public License as published by *
17  * the Free Software Foundation; either version 2 of the License, or *
18  * (at your option) any later version. *
19  * *
20  ***************************************************************************/
21 #ifndef SCMENU_H
22 #define SCMENU_H
23 
24 #include <QAction>
25 #include <QIcon>
26 #include <QPointer>
27 #include <QList>
28 #include <QMenu>
29 
30 class QMenu;
31 class ScrAction;
32 
33 #include "scribusapi.h"
34 
35 class SCRIBUS_API ScrPopupMenu : public QObject
36 {
37  Q_OBJECT
38  public:
39  ScrPopupMenu ( QWidget * parent = 0, const QString pMenuName = QString::null, const QString pMenuText = QString::null, const QString parentName = QString::null, bool checkable = false);
40  ~ScrPopupMenu ();
41 
42  const QString getMenuName();
43  const QString getParentMenuName();
44  const QString getMenuText();
45  void setText(const QString pMenuText);
46  const QIcon getMenuIcon();
47  void setMenuIcon(const QIcon pMenuIcon);
48  void setEnabled(bool menuEnabled);
49  QMenu *getLocalPopupMenu();
50  bool repopulateLocalMenu();
51  bool clear();
52 
53  bool insertSubMenu(ScrPopupMenu *newSubMenu);
54  bool insertMenuItem(ScrAction *newMenuAction);
55  bool insertMenuItemAfter(ScrAction *newMenuAction, ScrAction *afterMenuAction);
56  bool insertMenuSeparator();
57 
58  bool hasSubMenu(ScrPopupMenu *subMenu);
59  bool removeSubMenu(ScrPopupMenu *subMenu);
60  bool removeMenuItem(ScrAction *menuAction);
61  bool setSubMenuText(ScrAction *menuAction);
62 
63  bool generateEntryList(QStringList *actNames);
64  void setParentMenuName(const QString& newParentMenuName);
65 
66  protected:
67  QMenu *localPopupMenu;
68  QList< QPointer<QObject> > menuItemList;
69  QString menuName;
70  QString parentMenuName;
71  int parentMenuID;
72  QString menuText;
73  QIcon menuIcon;
74  int menuBarID;
75  bool enabled;
76  bool checkable;
77 };
78 #endif
79 
Definition: scmenu.h:35
Definition: scraction.h:33