00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ 00002 /* AbiWord 00003 * Copyright (C) 2004-2006 Tomas Frydrych <dr.tomas@yahoo.co.uk> 00004 * Copyright (C) 2009 Hubert Figuiere 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00019 * 02110-1301 USA. 00020 */ 00021 00022 #ifndef EV_QTMENU_H 00023 #define EV_QTMENU_H 00024 00025 #include <QMenuBar> 00026 #include <QVector> 00027 #include <QObject> 00028 #include <QAction> 00029 00030 #include "ev_Menu.h" 00031 00032 class AV_View; 00033 class XAP_QtApp; 00034 class XAP_QtFrameImpl; 00035 class XAP_Frame; 00036 class EV_QtMenuSlot; 00037 00038 /*****************************************************************/ 00039 00040 class EV_QtMenu : public EV_Menu 00041 { 00042 public: 00043 EV_QtMenu(XAP_QtApp * pQtApp, 00044 XAP_Frame * pFrame, 00045 const char * szMenuLayoutName, 00046 const char * szMenuLabelSetName); 00047 virtual ~EV_QtMenu(); 00048 00049 bool synthesizeMenu(QMenuBar * menuRoot, bool isPopup); 00050 bool menuEvent(XAP_Menu_Id id); 00051 virtual bool refreshMenu(AV_View * pView) = 0; 00052 00053 XAP_Frame * getFrame(); 00054 00055 protected: 00056 bool _refreshMenu(AV_View * pView, QMenuBar * menuRoot); 00057 bool _isItemPresent(XAP_Menu_Id id) const; 00058 virtual bool _doAddMenuItem(UT_uint32 layout_pos); 00059 00060 protected: // FIXME! These variables should be private. 00061 XAP_QtApp * m_pQtApp; 00062 XAP_Frame * m_pFrame; 00063 00064 // actual QT menu widgets 00065 QVector<QObject*> m_vecMenuWidgets; 00066 // menu slot classes 00067 QVector<EV_QtMenuSlot*> m_vecMenuSlots; 00068 }; 00069 00070 #endif /* EV_QTMENU_H */