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: QtxActionMgr.h
20 // Author: Alexander SOLOVYEV, Sergey TELKOV
22 #ifndef QTXACTIONMGR_H
23 #define QTXACTIONMGR_H
35 #pragma warning( disable:4251 )
38 class QTX_EXPORT QtxActionMgr : public QObject
42 class SeparatorAction;
52 QtxActionMgr( QObject* parent );
53 virtual ~QtxActionMgr();
55 virtual int registerAction( QAction*, const int = -1 );
56 virtual void unRegisterAction( const int );
58 QAction* action( const int ) const;
59 int actionId( const QAction* ) const;
60 bool contains( const int ) const;
64 void idList( QIntList& ) const;
66 bool isUpdatesEnabled() const;
67 virtual void setUpdatesEnabled( const bool );
69 virtual bool isVisible( const int, const int ) const;
70 virtual void setVisible( const int, const int, const bool );
74 virtual bool isEnabled( const int ) const;
75 virtual void setEnabled( const int, const bool );
77 static QAction* separator( const bool = false );
80 virtual void internalUpdate();
81 int generateId() const;
84 typedef QMap<int, QAction*> ActionMap;
92 QTX_EXPORT typedef QMap<QString, QString> ItemAttributes;
94 class QtxActionMgr::Creator
97 Creator( QtxActionMgr::Reader* );
100 Reader* reader() const;
102 virtual int append( const QString&, const bool,
103 const ItemAttributes&, const int ) = 0;
104 virtual void connect( QAction* ) const;
106 virtual bool loadPixmap( const QString&, QPixmap& ) const;
109 static int intValue( const ItemAttributes&, const QString&, const int );
110 static QString strValue( const ItemAttributes&, const QString&,
111 const QString& = QString::null );
113 QtxActionMgr::Reader* myReader;
116 class QtxActionMgr::Reader
120 QTX_EXPORT virtual ~Reader();
122 QTX_EXPORT QStringList options() const;
123 QTX_EXPORT QString option( const QString&, const QString& = QString::null ) const;
124 QTX_EXPORT void setOption( const QString&, const QString& );
126 QTX_EXPORT virtual bool read( const QString&, Creator& ) const = 0;
129 QMap< QString, QString > myOptions;
132 class QtxActionMgr::XMLReader : public Reader
135 QTX_EXPORT XMLReader( const QString&, const QString&, const QString& );
136 QTX_EXPORT virtual ~XMLReader();
138 QTX_EXPORT virtual bool read( const QString&, Creator& ) const;
141 QTX_EXPORT virtual void read( const QDomNode&, const int, Creator& ) const;
142 QTX_EXPORT virtual bool isNodeSimilar( const QDomNode&, const QString& ) const;