1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/
19 // File: QtxActionToolMgr.h
20 // Author: Alexander SOLOVYEV, Sergey TELKOV
22 #ifndef QTXACTIONTOOLMGR_H
23 #define QTXACTIONTOOLMGR_H
29 #include "QtxActionMgr.h"
35 #pragma warning( disable:4251 )
38 class QTX_EXPORT QtxActionToolMgr : public QtxActionMgr
45 ToolNode() : id( -1 ), visible( true ) {};
51 typedef QValueList<ToolNode> NodeList;
57 QtxActionToolMgr( QMainWindow* );
58 virtual ~QtxActionToolMgr();
60 QMainWindow* mainWindow() const;
62 int createToolBar( const QString&, int = -1 );
63 void removeToolBar( const QString& );
64 void removeToolBar( const int );
66 int insert( const int, const int, const int = -1 );
67 int insert( QAction*, const int, const int = -1 );
68 int insert( const int, const QString&, const int = -1 );
69 int insert( QAction*, const QString&, const int = -1 );
71 int append( const int, const int );
72 int append( QAction*, const int );
73 int append( const int, const QString& );
74 int append( QAction*, const QString& );
76 int prepend( const int, const int );
77 int prepend( QAction*, const int );
78 int prepend( const int, const QString& );
79 int prepend( QAction*, const QString& );
81 virtual bool isVisible( const int, const int ) const;
82 virtual void setVisible( const int, const int, const bool );
84 void show( const int );
85 void hide( const int );
86 bool isShown( const int ) const;
87 void setShown( const int, const bool );
89 void remove( const int, const int );
90 void remove( const int, const QString& );
92 QToolBar* toolBar( const int ) const;
93 QToolBar* toolBar( const QString& ) const;
95 bool hasToolBar( const int ) const;
96 bool hasToolBar( const QString& ) const;
98 virtual bool load( const QString&, QtxActionMgr::Reader& );
101 void onToolBarDestroyed();
104 int find( QToolBar* ) const;
105 int find( const QString& ) const;
106 QToolBar* find( const QString&, QMainWindow* ) const;
108 virtual void internalUpdate();
109 void updateToolBar( const int );
112 void simplifySeparators( QToolBar* );
115 typedef struct { NodeList nodes; QToolBar* toolBar; } ToolBarInfo;
116 typedef QMap<int, ToolBarInfo> ToolBarMap;
119 ToolBarMap myToolBars;
120 QMainWindow* myMainWindow;
123 class QtxActionToolMgr::ToolCreator : public QtxActionMgr::Creator
126 ToolCreator( QtxActionMgr::Reader*, QtxActionToolMgr* );
127 virtual ~ToolCreator();
129 virtual int append( const QString&, const bool,
130 const ItemAttributes&, const int );
133 QtxActionToolMgr* myMgr;