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: QtxMRUAction.h
20 // Author: Sergey TELKOV
22 #ifndef QTXMRUACTION_H
23 #define QTXMRUACTION_H
25 #include "QtxAction.h"
28 #include <qstringlist.h>
34 #pragma warning( disable:4251 )
37 class QTX_EXPORT QtxMRUAction : public QtxAction
41 Q_PROPERTY( int visibleCount READ visibleCount WRITE setVisibleCount )
44 enum { Items, SubMenu };
45 enum { MoveFirst, MoveLast, AddFirst, AddLast };
48 QtxMRUAction( QObject* = 0, const char* = 0 );
49 QtxMRUAction( const QString&, const QString&, QObject*, const char* = 0 );
50 QtxMRUAction( const QString&, const QIconSet&, const QString&, QObject*, const char* = 0 );
51 virtual ~QtxMRUAction();
53 int insertMode() const;
54 void setInsertMode( const int );
56 int popupMode() const;
57 void setPopupMode( const int );
62 int visibleCount() const;
63 void setVisibleCount( const int );
65 void remove( const int );
66 void remove( const QString& );
67 void insert( const QString& );
69 QString item( const int ) const;
70 int find( const QString& ) const;
71 bool contains( const QString& ) const;
73 virtual bool addTo( QWidget* );
74 virtual bool addTo( QWidget*, const int );
76 virtual bool removeFrom( QWidget* );
78 virtual void loadLinks( QtxResourceMgr*, const QString&, const bool = true );
79 virtual void saveLinks( QtxResourceMgr*, const QString&, const bool = true ) const;
82 void activated( QString );
85 virtual void setEnabled( bool );
89 void onActivated( int );
90 void onDestroyed( QObject* );
94 void checkPopup( QPopupMenu* );
95 void updatePopup( QPopupMenu*, const int );
96 bool removeLinks( QPopupMenu*, const int );
97 bool insertLinks( QPopupMenu*, const int, const int = -1 );
99 int findId( QPopupMenu*, QPopupMenu* ) const;
102 typedef struct { int pId, nId; QIntList idList; } Item;
103 typedef QMap<QPopupMenu*, Item> ItemsMap;
104 typedef QMap<QPopupMenu*, QPopupMenu*> MenusMap;