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
42 typedef enum { Items, SubMenu } PopupMode;
43 typedef enum { MoveFirst, MoveLast, AddFirst, AddLast } InsertMode;
46 QtxMRUAction( QObject* = 0, const char* = 0 );
47 QtxMRUAction( const QString&, const QString&, QObject*, const char* = 0 );
48 QtxMRUAction( const QString&, const QIconSet&, const QString&, QObject*, const char* = 0 );
49 virtual ~QtxMRUAction();
51 int insertMode() const;
52 void setInsertMode( const int );
54 int popupMode() const;
55 void setPopupMode( const int );
60 int visibleCount() const;
61 void setVisibleCount( const int );
63 void remove( const int );
64 void remove( const QString& );
65 void insert( const QString& );
67 QString item( const int ) const;
68 int find( const QString& ) const;
69 bool contains( const QString& ) const;
71 virtual bool addTo( QWidget* );
72 virtual bool addTo( QWidget*, const int );
74 virtual bool removeFrom( QWidget* );
76 virtual void loadLinks( QtxResourceMgr*, const QString&, const bool = true );
77 virtual void saveLinks( QtxResourceMgr*, const QString&, const bool = true ) const;
80 void activated( QString );
83 virtual void setEnabled( bool );
87 void onActivated( int );
88 void onDestroyed( QObject* );
92 void checkPopup( QPopupMenu* );
93 void updatePopup( QPopupMenu*, const int );
94 bool removeLinks( QPopupMenu*, const int );
95 bool insertLinks( QPopupMenu*, const int, const int = -1 );
97 int findId( QPopupMenu*, QPopupMenu* ) const;
100 typedef struct { int pId, nId; QIntList idList; } Item;
101 typedef QMap<QPopupMenu*, Item> ItemsMap;
102 typedef QMap<QPopupMenu*, QPopupMenu*> MenusMap;