Back to index

scribus-ng  1.3.4.dfsg+svn20071115
menumanager.h
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 /***************************************************************************
00008     begin                : Jan 2005
00009     copyright            : (C) 2005 by Craig Bradney
00010     email                : cbradney@zip.com.au
00011  ***************************************************************************/
00012 
00013 /***************************************************************************
00014  *                                                                         *
00015  *   This program is free software; you can redistribute it and/or modify  *
00016  *   it under the terms of the GNU General Public License as published by  *
00017  *   the Free Software Foundation; either version 2 of the License, or     *
00018  *   (at your option) any later version.                                   *
00019  *                                                                         *
00020  ***************************************************************************/
00021 #ifndef MENUMANAGER_H
00022 #define MENUMANAGER_H
00023 
00024 #include <qaction.h>
00025 #include <qobject.h>
00026 #include <qptrlist.h>
00027 #include <qpoint.h>
00028 
00029 class QMenuBar;
00030 class QPopupMenu;
00031 
00032 #include "scribusapi.h"
00033 class ScrAction;
00034 class ScrPopupMenu;
00035 class ScribusMainWindow;
00036 
00040 class SCRIBUS_API MenuManager : public QObject
00041 {
00042        Q_OBJECT
00043 public:
00044        MenuManager(QMenuBar* mb, QObject *parent = 0, const char *name = 0);
00045        ~MenuManager();
00046 
00047        enum MenuType {Normal, DLL};
00048 
00049        bool createMenu(const QString &menuName, const QString &menuText = QString::null, const QString parent = QString::null, bool checkable = false);
00050        bool createMenu(const QString &menuName, const QIconSet menuIcon, const QString &menuText = QString::null, const QString parent = QString::null, bool checkable = false);
00051        bool addMenuToMenu(const QString & child, const QString &parent);
00052        bool deleteMenu(const QString &menuName, const QString &parent = QString::null);
00053        bool clearMenu(const QString &menuName);
00054        void setMenuText(const QString &menuName, const QString &menuText);
00055        void setMenuIcon(const QString &menuName, const QIconSet &menuIcon);
00056        QPopupMenu *getLocalPopupMenu(const QString &menuName);
00057        void setMenuEnabled(const QString &menuName, const bool enabled);
00058        bool addMenuToMenuBar(const QString &menuName);
00059        bool addMenuToMenuBarAfter(const QString &, const QString &);
00060        bool removeMenuFromMenuBar(const QString &menuName);
00061        bool addMenuToWidgetOfAction(const QString &menuName, ScrAction *action);
00062 
00063        bool addMenuItem(ScrAction *menuAction, const QString &parent);
00064        bool addMenuItem(QWidget * widget, const QString &parent);
00065        bool addMenuItemAfter(ScrAction *menuAction, const QString &parent, ScrAction *afterMenuAction);
00066 //     bool addMenuItemAfter(ScrAction *menuAction, const QString &parent, const QString &afterMenuName);
00067        bool addMenuSeparator(const QString &parent);
00068 
00069        bool removeMenuItem(ScrAction *menuAction, const QString &parent);
00070 
00071        void runMenuAtPos(const QString &, const QPoint);
00072 
00073        void generateKeyManList(QStringList *actionNames);
00074        bool empty();
00075 
00076 private:
00077        QMenuBar *scribusMenuBar;
00078        QMap<QString, ScrPopupMenu *> menuList;
00079 };
00080 
00081 #endif
00082