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 = nullptr, const QString& pMenuName = QString(), const QString& pMenuText = QString(), const QString& parentName = QString(), bool checkable = false); 40 ~ScrPopupMenu (); 41 42 QString getMenuName(); 43 QString getParentMenuName(); 44 QString getMenuText(); 45 void setText(const QString& pMenuText); 46 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 80