X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FQtx%2FQtxActionToolMgr.h;h=5becb8187a93eea36934a6ec6af7997bea1a3a0a;hb=2400f3659b65727d5a776dccd3d5dd506d755a88;hp=48a7227859a079109d8c7c8fac0d484fd19843c7;hpb=101fd10f1e736daa5d7f0f0ee5499b951460832a;p=modules%2Fgui.git diff --git a/src/Qtx/QtxActionToolMgr.h b/src/Qtx/QtxActionToolMgr.h index 48a722785..5becb8187 100644 --- a/src/Qtx/QtxActionToolMgr.h +++ b/src/Qtx/QtxActionToolMgr.h @@ -1,35 +1,40 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: QtxActionToolMgr.h -// Author: Alexander SOLOVYEV, Sergey TELKOV +// File: QtxActionToolMgr.h +// Author: Alexander SOLOVYOV, Sergey TELKOV +// #ifndef QTXACTIONTOOLMGR_H #define QTXACTIONTOOLMGR_H #include "Qtx.h" - -#include - #include "QtxActionMgr.h" +#include +#include + class QToolBar; class QMainWindow; +class QAction; #ifdef WIN32 #pragma warning( disable:4251 ) @@ -43,12 +48,13 @@ class QTX_EXPORT QtxActionToolMgr : public QtxActionMgr { public: ToolNode() : id( -1 ), visible( true ) {}; + ToolNode( const int _id ) : id( _id ), visible( true ) {}; - int id; - bool visible; + int id; //!< tool node ID + bool visible; //!< visibility status }; - typedef QValueList NodeList; + typedef QList NodeList; //!< toolbar nodes list protected: class ToolCreator; @@ -59,7 +65,12 @@ public: QMainWindow* mainWindow() const; - int createToolBar( const QString&, int = -1 ); + int createToolBar( const QString&, int = -1, QMainWindow* = 0, bool = true ); + int createToolBar( const QString&, const QString&, int = -1, QMainWindow* = 0, bool = true ); + int createToolBar( const QString&, bool, Qt::ToolBarAreas = Qt::AllToolBarAreas, + int = -1, QMainWindow* = 0, bool = true ); + int createToolBar( const QString&, const QString&, bool, Qt::ToolBarAreas = Qt::AllToolBarAreas, + int = -1, QMainWindow* = 0, bool = true ); void removeToolBar( const QString& ); void removeToolBar( const int ); @@ -91,35 +102,42 @@ public: QToolBar* toolBar( const int ) const; QToolBar* toolBar( const QString& ) const; + QIntList toolBarsIds() const; bool hasToolBar( const int ) const; bool hasToolBar( const QString& ) const; bool containsAction( const int, const int = -1 ) const; + int index( const int, const int ) const; virtual bool load( const QString&, QtxActionMgr::Reader& ); + int find( QToolBar* ) const; + protected slots: void onToolBarDestroyed(); protected: - int find( QToolBar* ) const; int find( const QString& ) const; QToolBar* find( const QString&, QMainWindow* ) const; virtual void internalUpdate(); void updateToolBar( const int ); + virtual void updateContent(); + private: void simplifySeparators( QToolBar* ); + void triggerUpdate( const int ); private: - typedef struct { NodeList nodes; QToolBar* toolBar; } ToolBarInfo; - typedef QMap ToolBarMap; + typedef struct { NodeList nodes; QToolBar* toolBar; } ToolBarInfo; //!< toolbar info + typedef QMap ToolBarMap; //!< toolbars map private: - ToolBarMap myToolBars; - QMainWindow* myMainWindow; + ToolBarMap myToolBars; //!< toobars map + QMainWindow* myMainWindow; //!< parent main window + QMap myUpdateIds; //!< list of actions ID being updated }; class QtxActionToolMgr::ToolCreator : public QtxActionMgr::Creator @@ -132,7 +150,7 @@ public: const ItemAttributes&, const int ); private: - QtxActionToolMgr* myMgr; + QtxActionToolMgr* myMgr; //!< toolbar manager }; #endif