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_QTTOOLBAR_H 00023 #define EV_QTTOOLBAR_H 00024 00025 #include <vector> 00026 #include <QEvent> 00027 #include <QWidget> 00028 #include <QBoxLayout> 00029 #include <QToolBar> 00030 #include <Qt> 00031 00032 #include "ev_Toolbar.h" 00033 #include "xav_Listener.h" 00034 #include "xap_FontPreview.h" 00035 #include "xap_Strings.h" 00036 00037 #include "ut_types.h" 00038 #include "ut_vector.h" 00039 #include "xap_Types.h" 00040 #include "xav_Listener.h" 00041 #include "ap_Toolbar_Id.h" 00042 00043 class XAP_QtApp; 00044 class XAP_Frame; 00045 class EV_QtToolbar_ViewListener; 00046 00047 class _wd; 00048 00049 class EV_QtToolbar : public EV_Toolbar 00050 { 00051 public: 00052 EV_QtToolbar(XAP_QtApp * pQtApp, 00053 XAP_Frame *pFrame, 00054 const char * szToolbarLayoutName, 00055 const char * szToolbarLabelSetName); 00056 00057 virtual ~EV_QtToolbar(void); 00058 00059 bool toolbarEvent(_wd * wd, const UT_UCSChar * pData, UT_uint32 dataLength); 00060 virtual bool synthesize(void); 00061 bool bindListenerToView(AV_View * pView); 00062 virtual bool refreshToolbar(AV_View * pView, AV_ChangeMask mask); 00063 virtual bool repopulateStyles(void); 00064 UT_sint32 destroy(void); 00065 void rebuildToolbar(UT_sint32 oldpos); 00066 XAP_QtApp * getApp(void); 00067 XAP_Frame * getFrame(void); 00068 void setCurrentEvent(QEvent * event) {m_eEvent = event;} 00069 virtual void show(void); 00070 virtual void hide(void); 00071 00072 XAP_FontPreview * m_pFontPreview; 00073 gint m_pFontPreviewPositionX; 00074 protected: 00075 virtual Qt::ToolButtonStyle getStyle(void); 00076 virtual bool getDetachable(void) { return true; } 00077 virtual void setDetachable(gboolean /*detachable*/) { /* only the GNOME version does that ATM */ } 00078 00079 virtual QBoxLayout* _getContainer(); 00080 00081 void _releaseListener(void); 00082 00083 XAP_QtApp * m_pQtApp; 00084 XAP_Frame * m_pFrame; 00085 AV_ListenerId m_lid; /* view listener id */ 00086 00087 QEvent * m_eEvent; 00088 QToolBar * m_wToolbar; 00089 QWidget * m_wHandleBox; 00090 std::vector<_wd*> m_vecToolbarWidgets; 00091 }; 00092 00093 #endif /* EV_QTTOOLBAR_H */