00001 // Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE 00002 // 00003 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, 00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 00005 // 00006 // This library is free software; you can redistribute it and/or 00007 // modify it under the terms of the GNU Lesser General Public 00008 // License as published by the Free Software Foundation; either 00009 // version 2.1 of the License. 00010 // 00011 // This library 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 GNU 00014 // Lesser General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU Lesser General Public 00017 // License along with this library; if not, write to the Free Software 00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 // 00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com 00021 // 00022 00023 // File: QtxDockAction.h 00024 // Author: Sergey TELKOV 00025 // 00026 #ifndef QTXDOCKACTION_H 00027 #define QTXDOCKACTION_H 00028 00029 #include "QtxAction.h" 00030 00031 #include <QList> 00032 00033 class QIcon; 00034 class QString; 00035 class QToolBar; 00036 class QDockWidget; 00037 class QMainWindow; 00038 00039 #ifdef WIN32 00040 #pragma warning( disable:4251 ) 00041 #endif 00042 00043 class QTX_EXPORT QtxDockAction : public QtxAction 00044 { 00045 Q_OBJECT 00046 00047 public: 00049 enum { ToolBar, 00050 DockWidget, 00051 Both 00052 } DockType; 00053 00054 public: 00055 QtxDockAction( QMainWindow* ); 00056 QtxDockAction( const QString&, const QString&, QMainWindow* ); 00057 QtxDockAction( const QString&, const QIcon&, const QString&, QMainWindow* ); 00058 virtual ~QtxDockAction(); 00059 00060 void update(); 00061 00062 int dockType() const; 00063 void setDockType( const int ); 00064 00065 QMainWindow* mainWindow() const; 00066 00067 private slots: 00068 void onAboutToShow(); 00069 00070 protected: 00071 virtual void addedTo( QWidget* ); 00072 virtual void removedFrom( QWidget* ); 00073 00074 private: 00075 void initialize(); 00076 void updateMenu(); 00077 00078 void toolBars( QList<QToolBar*>& ) const; 00079 void dockWidgets( QList<QDockWidget*>& ) const; 00080 00081 private: 00082 int myType; 00083 QMainWindow* myMain; 00084 }; 00085 00086 #ifdef WIN32 00087 #pragma warning( default:4251 ) 00088 #endif 00089 00090 #endif // QTXDOCKACTION_H