Back to index

scribus-ng  1.3.4.dfsg+svn20071115
scmenu.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 SCMENU_H
00022 #define SCMENU_H
00023 
00024 #include <qaction.h>
00025 #include <qiconset.h>
00026 #include <qguardedptr.h>
00027 
00028 class QPopupMenu;
00029 class ScrAction;
00030 
00031 #include "scribusapi.h"
00032 
00033 class SCRIBUS_API ScrPopupMenu : public QObject
00034 {
00035        Q_OBJECT
00036        public:
00037               ScrPopupMenu ( QWidget * parent = 0, const char * name = 0, const QString pMenuName = QString::null, const QString pMenuText = QString::null, const QString parentName = QString::null, bool checkable = false);
00038               ScrPopupMenu ( QWidget * parent, const char * name, const QString pMenuName, const QIconSet pMenuIcon, const QString pMenuText, const QString parentName = QString::null, bool checkable = false);
00039               ~ScrPopupMenu ();
00040               
00041               const QString getMenuName();
00042               const QString getParentMenuName();
00043               const QString getMenuText();
00044               void setMenuText(const QString pMenuText);
00045               const QIconSet getMenuIcon();
00046               void setMenuIcon(const QIconSet pMenuIcon);
00047               void setMenuBarID(int id);
00048               int getMenuBarID();
00049               void setEnabled(bool menuEnabled);
00050               QPopupMenu *getLocalPopupMenu();
00051               bool repopulateLocalMenu();
00052               bool clear();
00053               
00054               bool insertSubMenu(ScrPopupMenu *newSubMenu);
00055               bool insertMenuItem(ScrAction *newMenuAction);
00056               bool insertMenuItem(QWidget *widget);
00057               bool insertMenuItemAfter(ScrAction *newMenuAction, ScrAction *afterMenuAction);
00058               //bool insertMenuItemAfter(ScrAction *newMenuAction, const QString afterMenuName);
00059               bool insertMenuSeparator();
00060               
00061               bool hasSubMenu(ScrPopupMenu *subMenu);
00062               bool removeSubMenu(ScrPopupMenu *subMenu);
00063               bool removeMenuItem(ScrAction *menuAction);
00064               bool setSubMenuText(ScrAction *menuAction);
00065               
00066               bool generateEntryList(QStringList *actNames);
00067               void setParentMenuID(int);
00068               const int getParentMenuID();
00069               void setParentMenuName(const QString& newParentMenuName);
00070               
00071        protected:
00072               QPopupMenu *localPopupMenu;
00073               QValueList< QGuardedPtr<QObject> > menuItemList;
00074               QString menuName;
00075               QString parentMenuName;
00076               int parentMenuID;
00077               QString menuText;
00078               QIconSet menuIcon;
00079               int menuBarID;
00080               bool enabled;
00081               bool checkable;
00082 };
00083 #endif
00084