Scribus
Open source desktop publishing at your fingertips
menumanager.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 MENUMANAGER_H
22 #define MENUMANAGER_H
23 
24 #include <QAction>
25 #include <QObject>
26 #include <QPoint>
27 #include <QMenu>
28 #include <QList>
29 #include <QMap>
30 #include <QPointer>
31 #include <QString>
32 
33 class QMenuBar;
34 
35 #include "scribusapi.h"
36 #include "actionmanager.h"
37 class ScrAction;
38 class ScribusMainWindow;
39 
43 class SCRIBUS_API MenuManager : public QObject
44 {
45  Q_OBJECT
46  public:
47  MenuManager(QMenuBar* mb, QObject *parent = 0);
48  ~MenuManager();
49 
50  enum MenuType {Normal, DLL};
51 
52  bool addMenuToWidgetOfAction(const QString &menuName, ScrAction *action);
53  bool createMenu(const QString &menuName, const QString &menuText = QString::null, const QString parent = QString::null, bool checkable = false, bool rememberMenu = false);
54  void removeMenuItem(const QString& s, ScrAction *menuAction, const QString &parent);
55  bool removeMenuItem(ScrAction *menuAction, const QString &parent);
56  void generateKeyManList(QStringList *actionNames);
57  void runMenuAtPos(const QString &, const QPoint);
58  void setMenuEnabled(const QString &menuName, const bool enabled);
59  void setText(const QString &menuName, const QString &menuText);
60 
61 
62 
63  QMenu *getLocalPopupMenu(const QString &menuName);
64  bool addMenuStringToMenuBar(const QString &menuName, bool rememberMenu=false);
65  bool addMenuStringToMenuBarBefore(const QString &, const QString &beforeMenuName);
66  void clear();
67  bool clearMenu(const QString &menuName);
68  bool empty();
69  bool menuExists(const QString &menuName);
70  void addMenuItemString(const QString& s, const QString &parent);
71  void addMenuItemStringAfter(const QString &s, const QString &after, const QString &parent);
72  void addMenuItemStringstoMenu(const QString &menuName, QMenu *menuToAddTo, const QMap<QString, QPointer<ScrAction> > &menuActions);
73  void addMenuItemStringstoRememberedMenu(const QString &menuName, const QMap<QString, QPointer<ScrAction> > &menuActions);
74  void addMenuItemStringstoMenuBar(const QString &menuName, const QMap<QString, QPointer<ScrAction> > &menuActions);
75  void clearMenuStrings(const QString &menuName);
76  void dumpMenuStrings();
77  QMenu *undoMenu() {return m_undoMenu;}
78  QMenu *redoMenu() {return m_redoMenu;}
79 
80  public slots:
81  void languageChange();
82 
83 protected:
84  QMenuBar *scribusMenuBar;
85 
86  QMap<QString, QList<QString> > menuStrings;
87  QMap<QString, QString> menuStringTexts;
88  QMap<QString, QMenu*> menuBarMenus;
89  QMap<QString, QMenu*> rememberedMenus;
90  //some hacks to keep undo menu functioning for now
91  QMenu *m_undoMenu;
92  QMenu *m_redoMenu;
93 };
94 
95 #endif
96 
This Class is the base class for your application. It sets up the main window and providing a menubar...
Definition: scribus.h:123
Definition: menumanager.h:43
Definition: scraction.h:33